This is possible with a little customization on the request side. Not sure if this is possible with attributes.
var returns = Query.Returns(
new OneToOne<Rule, RuleDetail, RuleDetail>(
callback: (rule, source, destination) => {
rule.Source = source;
rule.Destination = destination;
},
columnOverride: new ColumnOverride[] {
new ColumnOverride<RuleDetail>("SourceId", "Id"),
new ColumnOverride<RuleDetail>("SourceName", "Name"),
new ColumnOverride<RuleDetail>("SourceDateTime", "DateTime"),
new ColumnOverride<RuleDetail>("DestinationId", "Id"),
new ColumnOverride<RuleDetail>("DestinationName", "Name"),
new ColumnOverride<RuleDetail>("DestinationDateTime", "DateTime"),
},
splitColumns: new Dictionary<Type, string>() {
{ typeof(Rule), "Id" },
{ typeof(RuleDetail), "SourceId" },
{ typeof(RuleDetail), "DestinationId" },
}
)
);
return Db.Query(procedure, params, returns);
I'm not sure if all this code is needed for it to work, but it definitely shows how powerful the query in Insight.Database can be.
source
share