Greetings

My question is about working with the Entity Framework. Lets say I am having an Entity data model and I am having a dbconext instance what is the difference between dbcontext.EntityName.ExtensionMethodName(lambda expression) and dbcontext.EntityName.**Local**.ExtensionMethodName(lambda expression)

Ive not seen **Local** before.

Does that actually work??

Yeah it works fine

dbcontext.EntityName.Local.ExtensionMethodName(lambda expression)

If you meant the double Asterisks before and after the word Local I was just trying to bold the word so that it become apparent that it is all.

Ok I see.

I have never seen this before to be honest but have looked into it.

Consider the code below if I put a breakpoint on line 35. In there localContacts contains 1 item and the liveContacts contains several hundred.

So Local is all of the items which have not yet been committed to the database.

To quote MS - Gets an ObservableCollection<T> that represents a local view of all Added, Unchanged, and Modified entities in this set.

https://msdn.microsoft.com/en-us/library/gg696248%28v=vs.113%29.aspx?f=255&MSPPError=-2147217396

EFLocal.png

Thanks for help. I want to know something else please. When I work with Entity Framework and build my application. Is all the data in the database, which I used to build my data model, loaded into memory once the program is run?

No - its only loaded when you query it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.