Trying to scaffold a MySQL database with Rider
I am trying to scaffold a MySQL database. I am using Rider. I found this article on the MySQL website:
https://dev.mysql.com/doc/connector-net/en/connector-net-entityframework-core-scaffold-example.html
but the commands it uses seems to require Visual Studio which i am not using.
then i found this article from Jetbrains themselves:
https://blog.jetbrains.com/dotnet/2022/01/31/entity-framework-core-inside-rider-ui-way/#alternatives
The JetBrains Blog
Entity Framework Core Inside Rider: UI Way | The .NET Tools Blog
Do you work with Entity Framework Core? Would you like to manage entities right inside your IDE? Then you're in luck! JetBrains Rider helps you effectively manage everything you need in EF Core with e
29 Replies
but when i open the menu i see this:
instead of this:
What am i missing? This documentation looks like its for an older version of Rider, where can i find the current version?
found another article
The JetBrains Blog
Running Entity Framework (Core) commands in Rider | The .NET Tools ...
A while back, we received a very interesting question: how can we run Entity Framework commands like adding migrations or updating the database, in Rider?@JetBrainsRider how do I run EF commands i
this one had me run a version of this command in the terminal:
this thrw this error:
No project was found. Change the current working directory or use the --project option.
i messed around with it for a bit and eventualy found the right directory though trial and error
now i get this error:
followed my a massive stack trace starting with MySql.Data.MySqlClient.MySqlConnectionStringBuilder.<>c.<.cctor>b__0_18(MySqlConnectionStringBuilder msb, MySqlConnectionStringOption sender, Object value)
i have no idea what this IntegratedSecurity is or where i enabled it
ok, ive done some more looking
https://downloads.mysql.com/docs/connector-net-en.pdf (page 32) found this reference to IntegratedSecurity. looks like it enables windows authentication for connecting to the server. not sure if this is a featue of the database or a feature of my connection yet.
this bit (page 29) implies to me that this is somthing to do with the MySQLConnecter package on the .NET side. which means i need to figure out how to modify the command to disable this idenfityer
found the docs for this command: https://learn.microsoft.com/en-us/ef/core/cli/dotnet#dotnet-ef-dbcontext-scaffold
EF Core tools reference (.NET CLI) - EF Core
Reference guide for the Entity Framework Core .NET Core CLI tools
cant find anything that would let me disable
IntegratedSecurity
but i did find a bunch of other useful stuff
well. I cant find anything else
Ah, i am an idiot, its in the connectiron string
ok, new issue.
its built and it looks like ive got a conflict:which of these do i use?
for the moment i am using
Microsoft.EntityFrameworkCore.
but i dont actualy know which is best hereThe other one won't work
Unknown User•4mo ago
Message Not Public
Sign In & Join Server To View
there's another provider that's much better iirc
Unknown User•4mo ago
Message Not Public
Sign In & Join Server To View
MsSQL being Microsoft SQL Server?
but also i am locked into MySQL unfortunately
Unknown User•4mo ago
Message Not Public
Sign In & Join Server To View
Meaning not MySql.EntityFrameworkCore?
Unknown User•4mo ago
Message Not Public
Sign In & Join Server To View
i am not complaning to much. MySQL is where i got my start and its still what ive worked with most
will look into that
Unknown User•4mo ago
Message Not Public
Sign In & Join Server To View
Pomelo.EntityFrameworkCore.MySql 8.0.2
Pomelo's MySQL database provider for Entity Framework Core.
Unknown User•4mo ago
Message Not Public
Sign In & Join Server To View
I think the table’s just out of date.
Unknown User•4mo ago
Message Not Public
Sign In & Join Server To View
changed
ok. at some point i am going to have to hand this codebase off to someone. anyway to get around the whole needing to add
Microsoft.EntityFrameworkCore.
to every Index
decorator after i scaffold the database?
it would be great if i could just say in the docs "hey run this command when you update the database"Ideally, you'd be doing code-first instead of db-first, thus avoiding incorrectly generated code and not needing to bother remembering to re-scaffold any time the db structure changes
I might do this, but the database is massive and i know MySQL and not Entity Framework Core. need more experience
in the mean time it would be breath if i didn't have to specify where Index is coming from
its because you have both namespaces imported, and they both have something called
IndexAttribute
you can solve this by aliasing, or removing the ComponentModel usingok. well i am using data annotations as part of the scaffolding so that gets added automatically. I guess i am stuck edititng every file.