我试图理解一个asp.net的概念。我在这里做了整个练习。这简单。
现在尝试进一步了解,我创建了一个新的Asp.Net项目,并选择了Web API模板,如下所示。因此,我们看到选中了MVC和Web API复选框。
如果我观察到该项目,则AccountController是ApiController,因此views文件夹没有预期的任何Account和Manage文件夹。
现在我的问题是如何向上述项目添加Mvc帐户控制器?我很清楚,如果我在新项目对话框中选择MVC,如下所示,我就能明白。
What I want is to add is an MVC account controller along with the views exactly like the following in the Web api project show earlier.
This should be very easy I guess. So could someone please describe some steps? Like for example, which model and context we need to select on add scaffold and then Add Controller dialogs?
In other words I want to understand looking at a controller say AccountController be it Api or Mvc, how do I understand what is the model class and Data context associated with it.
The plenty of scafold templates that exists are very useful to have an application running. Even you can create a new WepApplication project and add the Nuget package AspNet.Identity Sample, wich has a lot of features.
但是,对于您的项目,建议您先从Empty Web Api项目开始,然后开始仅添加所需的内容。这样,您将更好地了解您的Wep Api如何与AspNet身份(帐户管理,外部登录提供商(例如Google或Facebook等)一起使用)。
此教程一步一步(和下一个系列)将引导您在实现和理解网页API和ASPNET身份从空Web API项目开始。
希望这可以帮助。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句