I am making a simple application in .net core and entity framework core, I want to separate the project by layers to work more organized, my questions are the following
1) I have to add a .net core class library to the solution? or a standard .net class library?
2) How can I generate the dbcontext file using command scaffold in my new layer?
Greetings, I recommend that you use .NET Standard since it will generate a library that is compatible with the majority of .net implementations (.NET Framework, dotnet core and xamarin).
Here they explain more details: https://docs.microsoft.com/en-us/dotnet/standard/net-standard
Regarding the generation of your dbcontext using scaffold
If you use Visual Studio you can follow these instructions to do it with NuGet Package Manager Console
1.Install-Package Microsoft.EntityFrameworkCore.SqlServer
2.Install-Package Microsoft.EntityFrameworkCore.Tools
Then you use this command to generate your database
Microsoft documentation here
If you use Visual Studio Code it would be using dotnet CLI
your project should look like this
To install these packages you must use dotnet add package.
After having the project in this way without any error, you use this command:
Remember that it is important to specify the startup project, which must be a .net core project from another. You would have to add the .net core framework to the .netstandard project, because for this to work, there must be a project using .net core somewhere. place
Official documentation here
related link