C# Entity Framework DBContext

c# dbcontext entity-framework-6

Question

I am trying to learn Code First EF6 and I am confused regarding DBContext.

The database I will be working on contains 800+ tables, while when working of specific parts of the application I am only dealing with 1-10 tables.

So my question is; would not having a DBContext involving 800+ Classes have a big negative impact on system resources?

I guess I am new to this technology and confused regarding the actual meaning of the information that I am taking in during my research.

Thank you.

NOTE: Thank you for your inputs. Please take a look at this post: Using multiple DbContexts with a generic repository and unit of work. There it states I cannot have tables in separate contexts that relate to each other?!

But in a real world scenerio my understanding is that it is common to break up the table relationships in focused areas, how is this done in Code First EF? Thanks again.

1
5
5/23/2017 11:46:03 AM

Popular Answer

You only need the tables you are working with in your db context (if the db already exists). The only reason you'd need a db context with all the tables would be if you want to recreate the whole db from scratch.

Take a look at the bounded context pattern from DDD: http://martinfowler.com/bliki/BoundedContext.html

3
12/30/2016 2:52:25 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow