Reputation: 99
In my RepositoryBase within the DAL I have the code below...I can't seem to figure out ObjectQuery query = ObjectSet; ? Am I close?
public IEnumerable<T> QueryObjectGraph(Expression<Func<T, bool>> filter, params string[] children)
{
//ObjectQuery<T> query = ObjectSet; //nope...requires 1 type argument
//ObjectQuery<T> query = ObjectSet<T>; //nope......type used like variable
// ObjectQuery<T> query = ObjectSet<T>(); //nope ...type used like variable
//ObjectQuery<T> query = new ObjectSet<T>(); //nope...no constructors defined
IQueryable<T> query;
foreach (var child in children)
{
query = query.Include(child);
}
return query.Where(filter);
}
Upvotes: 0
Views: 1592
Reputation: 11088
Chill out man. Didn't mean to sound rude. You just don't know what you are doing. If you look here http://msdn.microsoft.com/en-us/library/dd412719.aspx you see that ObjectSet is ObjectQuery so assignment does work. But you have to have ObjectSet created first!
"Since I am the expert"
Look amazingly this code works
using (var ctx = new ModelContainer())
{
ObjectQuery<Person> objectQuery = ctx.People;
}
and type of ctx.People is ObjectSet
What is ObjectSet commented out in your code? Where it is created?
Upvotes: 3