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.

Entity Framework Find vs. Where

Is there a significant difference between .Find(id) and .Where(x = >x.Id == id) that should compel me to …

.net performance entity-framework dbcontext
How to convert DbSet in Entity framework to ObjectQuery

I am using CodeFirst approach and struck with an issue where I need to convert DbSet to ObjectQuery. This is …

entity-framework-4 linq-to-entities ef-code-first dbcontext
"..." cannot implement an interface member because it is not public

public interface IDatabaseContext : IDisposable { IDbSet<MyEntity1> Entities1 { get; set; } } public class MyDbContext : DbContext, IDatabaseContext { IDbSet<MyEntity1> …

c# entity-framework dbcontext
"Object reference not set to an instance of an object" - but nothing is null?

Yeah, you probably think; "God, another one?". Yes, another one. "Object reference not set to an instance of an object." …

c# entity-framework-6 dbcontext
Exception has been thrown by the target of an invocation thrown when scaffolding a controller

I created a separate Class Library project to store the Database Context and Model Classes. In the same solution, I …

asp.net-mvc entity-framework dbcontext scaffold
NSubstitute DbSet / IQueryable<T>

So EntityFramework 6 is a lot better testable then previous versions. And there are some nice examples on the internet for …

c# entity-framework dbcontext nsubstitute dbset
Is it possible to query Entity Framework before calling DbContext.SaveChanges?

In this simple example, I have two entities: Event and Address. I have a console application running every night to …

c# entity-framework entity-framework-5 dbcontext savechanges
DbContext won't keep connection open for re-use

I'm trying to reuse an existing database connection so that I can do multiple database operations using a TransactionScope without …

c# entity-framework entity-framework-4.1 dbcontext
Why must I have a parameterless constructor for Code First / Entity Framework

This is more of a question of "Why we do things" as my actual problem was solved but I don't …

c# ef-code-first dbcontext
Entity Framework code first: How to ignore classes

This is similar to questions here and here, but those are old and have no good answers. Let's say I …

c# entity-framework poco dbcontext