I am reading in the book where author create custom context class (not using edmx file) for data access.
I wonder now.
In real world scenario what is most used method custom DbContext class or .edmx file(s).
I know that I should have different .edmx files if I use them but do I need to have the same if I use custom DbContext class.
If you’re using database or model first you have to have the edmx file – it is embedded in the dll, and the connection string references it. It contains the mapping information.
If using code first you never need an edmx file – the mapping information is derived by convention and/or by code (i.e. attributes etc). (Creating a custom DbContext is the code first approach)
The code first approach hasn’t been around as long as the database first approach, and therefore I would guess is more prevalent in real world scenarios. It is also more likely that a database first approach would be used when an existing database structure exists. However, the code first approach is rapidly gaining popularity.