Best Practice MS SQL
Best Practices and Issues with Microsoft SQL Server
Unable to create an object of type 'ServiceDbContext'. For the different patterns supported at design time
You get that error because to generate migrations you need either:
A DbContext with a default constructor (that is, a parameterless constructor) Being able to get the DbContext from ApplicationServices (that is, Dependency Injection) A design time factory that returns a properly configured DbContext. Since ApplicationDbContext constructor has a parameter, you have to use options 2 or 3. See the details in the article: https://docs.microsoft.com/ef/core/miscellaneous/cli/dbcontext-creation
But option 2 (the one originally used) doesn't work any more, because the program startup was changed to improve logging.
And, since there's no DesignTimeFactory for ApplicationDbContext you just won't be able to create migrations at this time.
If you want to learn about this way for creating migrations you can:
Create an ApplicationDbContextDesignTimeFactory, similar to CatalogContextDesignFactory or IntegrationEventLogContextDesignTimeFactory, or Try with other microservice like Catalog.API, that already has its DesignTimeFactory.
- Also see wiki page Deploy MS SQL to AWS