Entity Framework cast to ObjectSet
I'm pretty new to Entity Framework and I have a question. Is it possible to cast/convert a type var to a strongly typed ObjectSet.
For example I would like to do something like this (this is just an example from my head, not the real code):
var member = from item in memb开发者_Python百科er
where (age == 30)
select item;
EF.Member mbr = (EF.Member)member; // here I would like to cast/convert
Thanks!
Variable of type var
is already strongly typed. In your scenario it is IQueryable<Member>
. You can't cast it to ObjectSet<Member>
. You should be able to cast it to ObjectQuery<Member>
.
精彩评论