If you don't see any error messages, that means it's worked. \\ package, and then re-running the scaffolding command. Ensure your startup project is correct, install the package, and try again. This package is required for the Entity Framework Core Tools to work. \\Īlas that's stll not quite enough: Your startup project '' doesn't reference. \\ to the command: dotnet ef dbcontext scaffold "Server=.\ Database=Configuration Trusted_Connection=True " -startup-project. Now, move back to the folder for the Configuration.Database project and re-run the dotnet ef dbcontext scaffold command, but this time add -startup-project. \\ dotnet new console dotnet add reference. To solve it the simplest solution is to do exactly as the message states and add another project that can be used as the startup project: cd\ cd. For more information on using the EF Core Tools with. NET Framework that references this project, and set it as the startup project using -startup-project or, update this project to cross-target. NET Command-line Tools with this project, add an executable project targeting. There is no runtime associated with this framework, and projects targeting it cannot be executed directly. Unfortunately, running this results in the error message: Startup project '' targets framework '.NETStandard'. This is using two positional arguments for the command, the first to provide the connection string and the second to say what provider should be used. The command for me is: dotnet ef dbcontext scaffold "Server=.\ Database=Configuration Trusted_Connection=True " This is the interesting bit and is achieved by using the dotnet ef dbcontext scaffold command. ![]() \Configuration.Database\ package Ī few seconds later, NuGet has been interrogated and the package installed which means we can move onto the interesting bit, scaffolding the database! Scaffolding the database Now that the basic project structure is done, I'm going to add a package reference for, which will let me actually target Entity Framework Core towards my database: dotnet add. Of course, if you're not using git then swap that command out for one of your choice! I ran this in PowerShell which ends up looking a little bit like this: First up is creating the project and solution structure: md Configuration ![]() I've been working on a project recently for storing system configuration data (I know, I know, this is a problem that's been solved a thousand times over!) and after defining the database structure the next thing to do was to create an Entity Framework database context for it.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |