I have a generic repository and when I'm using a DoQuery method to select objects from the database, I need to load some of the related entities in order to not get nulls in the place of the fields that are foreign keys.
The problem is that the repository is generic, so I do not know how many properties need loading or what their names are (unless there's some way of getting them) how can I make it so that all of the foreign keys have their entities loaded while still keeping this repository generic?
Here's the DoQuery method:
public ObjectQuery<E> DoQuery(ISpecification<E> where)
{
ObjectQuery<E> query = (ObjectQuery<E>)_ctx.CreateQuery<E>("[" + typeof(E).Name + "]").Where(where.EvalPredicate);
return query;
}
And a link to the original code for the entire repository.
I posted this once before and never got the answer to it but I figure this one is a little bit more relevant since before people were assuming I knew the property names and could do:
.Include("PropertyNameIKnowNeedsToBeLoaded")
Here's the question I posted before hopefully that will provide a little information on where I'm at with this.
Any help is appreciated.
Thanks,
Matt