create a Class library project, data models with DataAnnotations validation, ApplicationContext class implementing DBContext, and implement IDesignTimeDbContextFactory to avoid the use of startup class.
https://geeksarray.com/blog/entity-framework-core-code-first-migration-using-separate-assembly