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!
As you can see in the above output, local keeps track of entities whose state is Added, Modified or Unchanged where as DbSet collection contains all the entities whose state is Deleted, Modified or Unchanged.
Step 1 − Create a new Console Application project. Step 2 − Right-click on project in solution explorer and select Add → New Item. Step 3 − Select ADO.NET Entity Data Model from the middle pane and enter name ViewModel in the Name field. Step 4 − Click Add button which will launch the Entity Data Model Wizard dialog.
An Entity can include two types of properties: Scalar Properties and Navigation Properties. Scalar Property: The type of primitive property is called scalar properties. Each scalar property maps to a column in the database table which stores the real data.
DbContext
, DbSet
etc. are part Entity Framework 4.1/4.2 which is shipped, among others, as the EntityFramework NuGet package. With just the .NET Framework you only have what is now called "Core EF Runtime" according to this:
In short, you need to install EF 4.1/4.2.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With