Search code examples
entity-framework-coredatabase-migration

Entity Framework Core configurations with existing database


In one of my projects, I am using an existing SQL Server database. All the database scripts are managed using DBUp and SQL script migrations.

In my application, I am using Entity Framework Core to communicate with this database. When I configure my entities in EF configurations, should I still define functions like IsRequired(), HasMaxLenth() etc.?

I am not using these EF configurations to generate migration scripts; all the migration is outside of EF. I am just using these configurations to communicate with the database.


Solution

  • When I configure my Entities in EF configurations, should I still define functions like IsRequired(), HasMaxLenth() etc.?

    Other than table and column name mapping and data type mapping, it's not required, but additional model metadata might be used by front-end components for validation.