I know I am missing something completely obvious, but why can’t I see the property Local when working with an EF context? The typical example online looks like the following:
context.Parents.Local
But I am unable to see the Local property. Now from what I understand, Local is a member of the DbSet class, and I don’t think I’m working with a DbSet in my application. What I do know is I’ve added a reference to the EntityFramework, have using System.Data.Entity and everything else I’m familiar with doing is working just fine. Except Local isn’t there, and I really do need some sorting capability for my DataGridView.
Help!
If you look at your auto-generated code for the context class, does it inherit from DbContext or ObjectContext?
If it is inheriting from ObjectContext, there are a few more steps you need to take.
Two *.tt files will be added to your project called something like MyModel.tt and MyModel.Context.tt.
After a recompile, look at your auto-generated code for the context again and it should now inherit from DbContext. Your Parents object will now be of type DbSet instead of ObjectSet and you will now be able to use the Local property.