无法访问CreateAsync在用户管理器 [英] Unable to access CreateAsync in User Manager
问题描述
我试图使用新的 Asp.Net身份
系统。我在asp.net网站,能找到一个教程的这里。
我创建注册
行动和它相应的视图。但无法code将其作为进一步我使用用户管理
在识别系统来袭。
要为precise,它在这里。
VAR的结果=等待UserManager.CreateAsync(用户,register.Password);
的的UserManager
类抛出异常
使用泛型类型'Microsoft.AspNet.Identity.UserManager< TUSER,TKEY的>'需要2个类型参数
我的问题是,为什么本教程的作者没有得到任何形式的异常?我错过任何依赖关系?
这似乎是文档是不是在asp.net网站如此完美为好。
任何帮助将是AP preciated。
VAR的结果=等待UserManager.CreateAsync(用户,register.Password);
的的UserManager
在上面的语句不是类
正如我的预期。其类型的属性的UserManager< ApplicationUser方式>
所以,在刚开始申报了财产
公开的UserManager< ApplicationUser> {的UserManager获得;私人集; }
现在,我可以使用异步
版本创建的用户。下面的语句的工作。
VAR的结果=等待UserManager.CreateAsync(用户,register.Password);
I'm trying to use the new Asp.Net Identity
system. I've searched this in asp.net site and able to find a tutorial here.
I've created Register
action and appropriate view for it. But Unable to code it further as I'm struck using User Manager
in Identity System.
To be precise, It's here.
var result = await UserManager.CreateAsync(user, register.Password);
The UserManager
class throws an exception
Using the generic type 'Microsoft.AspNet.Identity.UserManager<TUser,TKey>' requires 2 type arguments
My question is why did the author of the tutorial did not get any sort of exceptions ? Am I missing any dependencies ?
It seems like the documentation is not so perfect in asp.net site as well.
Any help would be appreciated.
var result = await UserManager.CreateAsync(user, register.Password);
The UserManager
in the above statement is not a Class
as I've expected. Its a property of type UserManager<ApplicationUser>
.
So, at the beginning just declared a property as
public UserManager<ApplicationUser> UserManager { get; private set; }
And now I can use the Async
version for creating users. The following statement works.
var result = await UserManager.CreateAsync(user, register.Password);
这篇关于无法访问CreateAsync在用户管理器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!