EF-Core unable to create migration
I'm trying to crate migration, but every single time I get this error. Startup project is set and in package manager project with
DbContext
is selected too. Haven't changed anything significant that I could think of since last migration.
DbContext
https://codeshare.io/k0zVX3
Method to add DbContext
https://codeshare.io/0bPKZl
Program class
https://codeshare.io/g8M7kR
(didn't copy fully since rest is not related to database)
AddServices()
https://codeshare.io/MkwOKQ10 Replies
Check if you're getting the connection string right , like if the builder is fetching it properly
There's also an exception being thrown related to the Hosting Package
it works just fine when I run code normally, I tried to hardcode connection string as well, but it's same.
why might it throw such exception?
can you reinstall that package ?
and see
Microsoft.Extensions.Hosting?
yeah
@gio735 forget that and check this out :
https://stackoverflow.com/questions/60561851/an-error-occurred-while-accessing-the-microsoft-extensions-hosting-services-when
Stack Overflow
An error occurred while accessing the Microsoft.Extensions.Hosting ...
I don't understand what wrong.
I tried to make a simple crud in .net core mvc with a very simple model which has few fields.
These are my models:
public class Employee
{
[Key] publi...
I hope you'll find solution in this thread as you're having the same problem
I think it's built in
thanks will check it
yup try the solutions in that thread and then let us know
just got home and it worked, but I just don't understand why it stopped working the way it was, also for
update-database
instead of package manager just ran code normally so context.Database.Migrate();
could do the work and it did just fine. Any idea what could cause it?