Top "Dbcontext" questions

The DbContext API first shipped with Entity Framework version 4.1 and provides a more productive surface for working with the Entity Framework and can be used with the Code First, Database First, and Model First approaches.

EF (entity framework) usage of "using" statement

I have a project on MVC. We chose EF for our DB transactions. We created some managers for the BLL …

c# entity-framework garbage-collection dbcontext using-statement
Most efficiently handling Create, Update, Delete with Entity Framework Code First

Note: I am using Entity Framework version 5 Inside my generic repository, I have Add, Edit and Delete methods as below: …

entity-framework ef-code-first dbcontext entity-framework-5
How change tracking works in Entity Framework

Given the following code, how does EF/DbContext knows about the change made to the customer object: class Program { static …

c# entity-framework-4 dbcontext change-tracking
EF Code First DBContext and Transactions

I would like know what is the best possible way to implement transactions with DBContext. In particular, Does DbContext.SaveChanges …

entity-framework transactions entity-framework-4.1 dbcontext
Removing many to many entity Framework

There is a many to many relationship between Artist and ArtistType. I can easily add artist ArtistType like below foreach (…

c# entity-framework many-to-many dbcontext
What does the DBContext.Entry do?

[HttpPost] public ActionResult Edit(Movie movie) { if (ModelState.IsValid) { db.Entry(movie).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } …

asp.net asp.net-mvc entity-framework dbcontext
'ObjectContext' vs 'DbContext' in Entity Framework

I'm using the DbContext class within code that I am creating that is based on the Generic Repositories and Unit …

.net entity-framework dbcontext objectcontext
LINQ many-to-many relationship, how to write a correct WHERE clause?

I use many-to-many relationship for my tables. There is a query: var query = from post in context.Posts from tag …

c# linq entity-framework-4 dbcontext
Using Automapper to update an existing Entity POCO

I am using EF4 DbContext to provide the model for an ASP.NET MVC app. I use ViewModels to provide …

asp.net-mvc entity-framework-4 viewmodel automapper dbcontext
DbContext is very slow when adding and deleting

When using DbContext in a database-first scenario I found out that adding and deleting entities is very slow compared to …

entity-framework dbcontext