Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why can I not see the property Local when using Entity Framework?

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!

like image 397
bcfoster Avatar asked Jan 31 '12 07:01

bcfoster


People also ask

What is local in Entity Framework?

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.

How do I access view in Entity Framework?

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.

What are the different types of properties supported in Entity Framework?

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.


1 Answers

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.

like image 145
cynic Avatar answered Nov 15 '22 05:11

cynic