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.

The entity type <type> is not part of the model for the current context

I am getting into the Entity Framework, but I am unsure if I am missing a critical point in the …

c# entity-framework ef-code-first dbcontext
How to update only one field using Entity Framework?

Here's the table Users UserId UserName Password EmailAddress and the code.. public void ChangePassword(int userId, string password){ //code to …

sql entity-framework-4 entity field dbcontext
How to fix the datetime2 out-of-range conversion error using DbContext and SetInitializer?

I'm using the DbContext and Code First APIs introduced with Entity Framework 4.1. The data model uses basic data types such …

c# .net entity-framework ef-code-first dbcontext
Entity Framework: One Database, Multiple DbContexts. Is this a bad idea?

My impression to date has been that a DbContext is meant to represent your database, and thus, if your application …

entity-framework ef-code-first entity-framework-4.3 dbcontext
One DbContext per web request... why?

I have been reading a lot of articles explaining how to set up Entity Framework's DbContext so that only one …

c# asp.net entity-framework dependency-injection dbcontext
Mocking EF DbContext with Moq

I'm trying to create a unit test for my service with a mocked DbContext. I created an interface IDbContext with …

c# unit-testing entity-framework-5 moq dbcontext
Entity Framework and calling context.dispose()

When should one call DbContext.dispose() with entity framework? Is this imaginary method bad? public static string GetName(string userId) { …

entity-framework dbcontext idisposable
How to force Entity Framework to always get updated data from the database?

I am using EntityFramework.Extended library to perform batch updates. The only problem is EF does not keep track of …

c# asp.net-mvc entity-framework dbcontext
How to set CommandTimeout for DbContext?

I am looking a way to set CommandTimeout for DbContext. After searching I found the way by casting DbContext into …

c# entity-framework-4 dbcontext command-timeout
Getting "The entity type <model> is not part of the model for the current context."

I am having this issue updating my database 1 column at a time in asp.net using web api. I am …

c# asp.net entity-framework dbcontext put