ASP.NET MVC - database first
Discussion
Taken a crash course in ASP.NET MVC to support a project.
I am struggling around inserting new record on a table with one-to-many relationship and wondering if someone here can help with some code snippets.
The main table is User with one-to many with UserRoles (FK User.Id)
Based on database first approach how do I build the model and controller which allows inserting new User and UserRoles records?
I am struggling around inserting new record on a table with one-to-many relationship and wondering if someone here can help with some code snippets.
The main table is User with one-to many with UserRoles (FK User.Id)
Based on database first approach how do I build the model and controller which allows inserting new User and UserRoles records?
Use EntityFramework to build the model, and use the context created by EF to do your CRUD calls.
No point in re-inventing the wheel for something like that.
This MS Learn link handles pretty much your complete scenario: https://learn.microsoft.com/en-us/ef/ef6/modeling/...
No point in re-inventing the wheel for something like that.
This MS Learn link handles pretty much your complete scenario: https://learn.microsoft.com/en-us/ef/ef6/modeling/...
Gassing Station | Computers, Gadgets & Stuff | Top of Page | What's New | My Stuff