开发者

Adding a controller with read/write actions and views, using Entity Framework - what is "Data Context class"?

开发者 https://www.devze.com 2023-03-05 22:12 出处:网络
So in Visual Studio, when I go to add a controller, I get this dialog:开发者_JS百科 I was curious what Visual Studio would create if I chose \"Controller with read/write actions and views, using En

So in Visual Studio, when I go to add a controller, I get this dialog:

开发者_JS百科

Adding a controller with read/write actions and views, using Entity Framework - what is "Data Context class"?

I was curious what Visual Studio would create if I chose "Controller with read/write actions and views, using Entity Framework", as I'm using EF.

So I set my Model class to a view model created, chose Razor for my views, but I don't know what Data context class is? The only thing in the dropdown is my view model I created.


The Data Context class is the top level EF object, the one that contains all your collections of entities that map to tables in the database.

The controller needs to be able to access this so that it can perform CRUD operations.

0

精彩评论

暂无评论...
验证码 换一张
取 消