ASP.NET 自定义 MembershipProvider,更改 CreateUser 语义或添加新方法
有没有办法添加额外的方法,比如这样的语义:
CreateUser(User user, UserInfo userInfo, IsInRole isInRole, <any another things here>)
我可以创建自定义方法并单独调用该方法,但为了保持一致,我只是想知道是否有任何方法可以自定义 MembershipProvider 像这样或者做类似的事情?
Is there any way to add additional method let say with semantic like that:
CreateUser(User user, UserInfo userInfo, IsInRole isInRole, <any another things here>)
I may create the custom method and call that method separately, but in order to keep the sings consistently i just wondering is there any way to customize MembershipProvider
like that or to do something similar?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我想您已经创建了自定义会员资格提供商。您只需在那里添加该方法,然后在您的应用程序中使用它即可。假设您有像这样的伪(简化)代码的自定义会员资格提供程序:
然后您可以在您的帐户控制器(或您想要的任何地方使用它。)
这个示例是简化的并且缺少任何形式的验证,但我认为您可以得到的想法。它表明您应该能够以任何您想要的方式扩展您的自定义会员资格提供程序。
I suppose you already have your custom membership provider created. You can simply add that method there and then use it in your application. Let's say that you have custom membership provider like this pseudo (simplified) code:
Then you can use it in your account controller (or anywhere you want..)
This example is simplified and missing any form of validation, but I think you can get the idea from it. It shows that you should be able to extend your custom membership provider any way you want.