NOTE : Make sure Microsoft.EntityFrameworkCore.Design package should be added to your project.
dotnet ef dbcontext scaffold "Filename=dbname.db" Microsoft. EntityFrameworkCore.Sqlite --table tablename --table tablename --outputdir Foldername --namespace Namespace --data-annotations --context DbcontextNote the following:
• The connection string: "Filename=Northwind.db"
• The database provider: Microsoft.EntityFrameworkCore.Sqlite
• The tables to generate models for: --table Categories --table Products
• The output folder: --output-dir AutoGenModels
• The namespace: --namespace WorkingWithEFCore.AutoGen
• To use data annotations as well as the Fluent API: --data-annotations
• To rename the context from [database_name]Context: --context Northwind
No comments:
Post a Comment