Now I'm trying to scaffold an identity set for my db but using the same context, so I change DbContext to IdentityDbContext as per some different answers I've found, but when scaffolding and generating code, I get this message: Cannot use an existing DbContext with the '-useDefaultUI' option.Īnd in a separate project I see by scaffolding an Identity I get this line added to my startup. I executed below scaffold-DbContext query. using scaffold-DbContext for database view (myview). 56 minutes to read 18 contributors Feedback In this article Prerequisites Create the web app project Set up the site style The data model The Student entity The Enrollment entity The Course entity Scaffold Student pages Database connection string Update the database context class Program. Public AllTheOtherStuffDbContext() : base("name=AllTheOtherStuffDbContext") Yes, we can use scaffold-DbContext with view. The resulting entities are created and mapped to the tables in the. Public class AllTheOtherStuffDbContext : DbContext In Visual Studio, select Tools NuGet Package Manger Package Manger Console and run the Scaffold-DbContext command. Scaffolding a database produces an Entity Framework model from an existing database. I've scaffolded a set of objects from a data object which has given me: namespace WebApplication1.Models It allows to specify all the tables, which. 2) create a new model and scaffold an API controller with read/writeĤ) change the created DbContext to inherit from IdentityDbContext One can solve the problem by usage of dotnet ef dbcontext scaffold command with multiple -t ( -table ) parameters.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |