Just a quick post on fixing up a migration error after I added new config to startup.cs via DI. The error after running add-migration was pretty unintuitive:
Unable to create an object of type 'ApplicationDbContext'. For the different patterns supported at design time, see https://go.microsoft.com/fwlink/?linkid=851728
To find out a bit more I ran the following:
This revealed the fact that there was an issue with adding my config line. The error stated that I had to have an empty constructor which led me on a bit of a wild goose chase.
The solution was simply a missed entry in application.json. In my case it was an omitted “assembly” section. Having said that, I did come across a few instances where people had the same problem when omitting commas etc.
Hopefully that’s able to get you on the right track!
Get your server instance security group:
– Log into AWS
– Navigate to elastic beanstalk
– Open your application instance
– Open configuration
– Open instances
– Find “server” on the page and copy the value in the “EC2 security groups” field
Add your server instance security group to your rds rules:
– Navigate to the RDS Dashboard
– Open your RDS instance
– Click on view details (left hand side or top)
– Find Security and Network
– Click on the rds-launch-wizard under security groups
– Click on inbound rules (very bottom currently)
– Add a new inbound rule with the copied security group as the source