Is there a way to get ObjectQuery<T> for specfied generic type?
Pseudo:
public partial class MyObjectContext
{
public ObjectSet<TEntity> GetObjectSet<TEntity>()
{
return Helper.GetObjectSet<TEntity>(this);
}
}
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Yes this is what you need:
As you can see your helper method is not needed because you can call
CreateObjectSetdirectly onMyObjectContextinstance. It will returnObjectSet<TEntity>which is derived fromObjectQuery<TEntity>. TEntity must be mapped type and it cannot be derived type in entity hierarchy.