I have a property on an entity called PathName. This property is not mapped to a field in the database. It will return a string value similar to below:
Entity1.Name -> Entity2.Name -> Entity3.Name -> this.Name
The property would be on "this". I am using Async by default for all queries. When NOT using Async, I can simply return the value as such:
return string.Format("{1} {0} {2} {0} {3} {0} {4}", "->",
this.Entity3.Entity2.Entity1.Name,
this.Entity2.ENtity1.Name,
this.Entiity1.Name,
this.Name;
If I do this with Async on by default, Entity1, 2, and 3 are not available immediately and the string is returned imcomplete. How would I code these kinds of "computed" properties where the property has to fetch data from other related entities (potentially through a complex query)?
I know if I create a query for "this" and put Includes for Entity1, 2 and 3, this will work properly but that requires the developer to know to include those properties on every query.
I am using the Repository pattern from Coctail if that helps any and usually use the FindAsync method to get various lists of "this". Again, what would the recommended way to getting these entities without the developer having to always include the additional Includes?
Thanks!