Closed fasteddys closed 1 year ago
1) You can add the connection string as a property of the designer surface. Click the design surface and these will appear in the property window. Note you can add either a connection string or a connection string name (with the connection string being stored in a config file somewhere else) and EFCore will be able to use it.
2) Generating the model gets you the entity classes and a DbContext -- from there you can create the migrations, use the context, etc. The EFCore docs talk about how the migrations can automatically create a database, how to update that structure, etc.
thanks
Been reading your docs a lot!! :)
I created an independent class lib in EF 6 (to keep this as clean as possible), and refer to the models from other projects.
this picture shows me, that I failed to add migrations. I assume its because there is a missing
connectionstring
in theDBcontext
Question 1:
How do I get the EF designer 2k22 code gen to pick up the connection string?,
so it can be scaffolded into the DBcontext. And, where does it pick it up from, I even tried to add aapp.config
file with a new connection string, but its not picking it up... should I be doing this differently?<?xml version="1.0" encoding="utf-8" ?>
Question 2: From the model generated, to create a new database ->
am I correct in creating a new migration, using that I would create my Database?
or how do I create the DB from the EF Designer Models?