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.

Can you get the DbContext from a DbSet?

In my application it is sometimes necessary to save 10,000 or more rows to the database in one operation. I've found …

c# entity-framework entity-framework-4.1 dbcontext dbset
unexpected GetType() result for entity entry

While I iterating through ObjectStateEntries I expected [t] variable name will be MY_ENTITY foreach (ObjectStateEntry entry in context.ObjectStateManager.…

c# entity-framework ef-code-first dbcontext objectstatemanager
Dispose method in web api 2 web service

I am coding an MVC 5 internet application with a web api 2 web service. Do I need a dispose method for …

asp.net-mvc-5 asp.net-web-api2 dispose dbcontext repository-design
DbContext SaveChanges() - Detecting updated entities

I have overridden the SaveChanges() method in the Entity Framework 4.1 DbContext class. My override looks like this: public override int …

c# entity-framework savechanges dbcontext
Is DbSet<>.Local something to use with special care?

For a few days now, I have been struggling with retrieving my entities from a repository (DbContext). I am trying …

c# entity-framework dbcontext dbset
c# System.AccessViolationException: Attempted to read or write protected memory.?

Not always but now and then i keep getting the below error, it doesn't effect me much "I think" but …

c# entity-framework dbcontext access-violation
How do I unit test a repository that uses DbContext with NSubstitute?

I have a solution in which I have a Data project that contains an EF6 .edmx file, generated from an …

c# entity-framework unit-testing dbcontext nsubstitute
Multiple DbContexts in N-Tier Application

I'm creating my first N-Tier MVC application and I've run into a road block with how to manage multiple DbContexts …

c# entity-framework-4.1 repository dbcontext unit-of-work
Convert Library from ObjectContext to DbContext

I have a library (based on code found in an old blog post) that allows me to very easily wrap …

entity-framework entity-framework-4.1 objectcontext dbcontext
Using INotifyPropertyChanged with Entity Framework 6 DbContext Generator

I know I can use ObjectContext instead, but I like the features of DbContext / DbSet. My application isn't large enough …

entity-framework-6 dbcontext inotifypropertychanged