Differences
- Code First: The code is written first. The database is generated from the code;
- Database First: The database is written first. The application code is generated from the database.
Pros and Cons
Code First
Pros
- Can work independently of database technology;
- Data validations are not strict to a technology;
- Can build and destroy databases generated in moments, through Migrations;
- Ideal for new applications;
Cons
- Does not mesh well with an existing database;
- Depends on a good ORM, such as the Entity Framework and NHibernate, for example;
- Requires constant optimization because data abstraction for some banks does not always perform well;
- Validation in database is limited. Database generation by application is never 100%;
- Poor database security.
Database First
Pros
- Ideal for performance and existing schemas;
- Application can be made on top of a database that already exists;
- Better-adjusted bank security;
Cons
- Generation of environments is limited; Complex to determine incremental changes of both the database and the application;
- Fully dependent on bank technology;
- Limitation of bank providers that can generate the application (ODBC helps, but does not completely solve the problem);
- Data validation generated for the limited application;
What changes in the architecture of a project and in the way the system is developed?
I think the previous items answer this question well. It all depends on the reality in which the new system is built, with a few additions.
In Code First , the database tracks the growth of the system. In Database First, the entire system must be generated at one time, and every incremental implementation must be manual.
In contrast, a Code First system is green for database security and performance. Most problems are solved by good practices, but there's always something to be desired, such as a huge or quirky table that requires extra optimization.