SQL 成员资格提供程序中的 MembershipUser 和 aspnet_User
我为 WCF 服务设置了 SQL 成员资格提供程序。
我有自定义表 Items,它有一个外键,将其链接到从会员资格提供程序创建的数据库中的 aspnet_Users 表。当我实例化 aspnet_User 类型的对象时,我可以将项目集合作为用户对象的属性进行访问。但会员资格提供程序仅适用于 MembershipUser 类。
据我所知,aspnet_User 和 MembershipUser 以某种方式链接在一起。当我尝试从 MembershipUser 访问 Items 集合时,这是不可能的,因为没有这样的属性。
您认为我如何访问我的物品收藏?
I set up the SQL Membership provider for my WCF service.
I have custom table Items which has a foreign key that links it to the aspnet_Users table in the db which was created from the Membership provider. When I instantiate an object from type aspnet_User I can access the collection of Items as a attribute to the User obejct. But the membership provider works only with MembershipUser class.
From what I realize the aspnet_User and MembershipUser are somehow linked. When I try to access the Items collection from the MembershipUser it's not possible because there isn't an attribute like that.
How do you think I can access my Items collection?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您仔细想想,Linq 2 SQL 对 ASP.NET 成员资格一无所知。那么为什么您期望两个系统之间进行合作呢?这将是神奇的。
答:您可以使用 (Guid)MembershipUser.ProviderUserKey 来获取用户的 ID。使用该 ID,您可以查询数据库。
If you think about it, Linq 2 SQL does not know anything about ASP.NET Membership. So why would you expect cooperation between the two systems? This would be magic.
Answer: You can use (Guid)MembershipUser.ProviderUserKey to get the ID of the user. Using that ID you can query the database.