I need to decide on the usage of Entity framework for a large enterprise application. I need to decide either on EF data first / Code first.
My main idea is not to mix Data Access with Database. I don't want any tool to generate/update database. I can design database schema first and can use EF Data first model. The problem with this approach is
Less control over the code generated by the EF and Huge configuration
I can use code first approach to solve above problems. But the problem with code fist is tight integration with database and EF. whenever I change my Model I need to create Migrations to update the changes to the DB. I am little worried with the changes "Migrations" will make to my DB. moreover If we have to apply these changes to Production DB its not at all possible as we development team won't have any access to production servers.
I am just thinking weather it is a good choice to choose EF code first as data access technology for an Enterprise application.
Can you guys suggest usage of EF code first without above problems?
EF is an ORM tool for quickly setting up the code required to map a database to a set of classes in code, and to perform general querying and data management with a direct 'symbiosis' between your classes and your db. It's absolutely possible to use Entity Framework on a large application.
Step 1 − First, create the console application from File → New → Project… Step 2 − Select Windows from the left pane and Console Application from the template pane. Step 3 − Enter EFCodeFirstDemo as the name and select OK. Step 4 − Right-click on your project in the solution explorer and select Manage NuGet Packages…
As per the above figure, Entity Framework fits between the business entities (domain classes) and the database. It saves data stored in the properties of business entities and also retrieves data from the database and converts it to business entities objects automatically.
Versioning databases is hard, but with code first and code first migrations, it's much more effective. Because your database schema is fully based on your code models, by version controlling your source code you're helping to version your database.
I would strongly recommend against Code First for a large enterprise level application.
Enterprise Level Applications normally have
Data First allows you to take all of this into consideration and not have a database bound by a project.
Code First is great when you have single use applications such as tablet apps or desktop apps or even just for doing quick development. When multiple projects need to access the same database, I would say Code First is no longer suitable.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With