Update Database with EF core doesn't work and no error message
i am trying to create a database with ef core. Adding a migration works. Update database doesn't, with no error message. The connection string i am using works with other projects without ef.
35 Replies
if i try with rider gui, i am getting this error but doesn't seem useful either
verbose output in terminal
This is a console application. In razor projects i tried it works fine. Add migration, Update Database etc.
I don't know if it helps narrowing down the issue, But i get the same behavior trying to "remove last migration"
no error message or anything
only "Add migration" seems to work
1. Delete the migration folder in the project
2. In PackageManagerConsole(bottom left probably) write Add Migration Init
3. Delete your database and close connections
4. write in Console "Update-Database"
Be sure to have extensions to manage your connection installed with the nugget package manager
Show me your solution?
And the registration of dbcontext.
the first screenshot shows the installed nuget packages. Those are the ones I need, no?
ur set is private
so you wont be able to actually access it lol
weird, it shows public for me
sry i thought you meant the repo is private 😆
no, the set is private
so youll never be able to interface with the tables
ok i changed it, but i am still getting the same error
ya thats not the specific problem
would have just been the next problem
as for ur migration issue, what is the rest of the verbose log output?
the migration works, that verbose output was from update database
ya i meant the application of the migration
the screenshot cuts stuff off
is the server running?
yep
i can connect and use it with other applications
can you connect to it with ssms
so, does the database exist at all
like was a CREATE run
i did try it with creating the database beforehand and without
but the tutorials i got the code from don't create database beforehand anyway
database update will create the db if it doesnt exist
yea
it does for me in razor projects for example
there it works
just not in consoleapplication
i find it just weird that i am not getting any proper error message at all
nothing that even hints me to the issue
that connection string is super weird
i tried with user and password in it as well
shouldnt server be uppercased
Server
quite sure i had it like that already
gonna try again
nope, doesn't help 😔
im fairly certain its ur conection string
run this
dotnet ef database update -v diag
same output as the verbose one
This is the connection string i use in another project which uses SQL, but not EF
there it works
Hmm
I'll have to look at this a little
I might pull it down and try, but i don't have sqlserver
i found the issue in the dumbest way possible. While trying different connection strings, i missed the semicolon once. Looks like it doesn't work with Trusted_Connection
thanks for helping
this is the string that worked after all
bothers me that i couldn't see that from any error messages though
what the hell
thats like... the correct syntax??
thats bizzare