在 EF CodeFirst 中使用成员资格提供程序
1) 如果我想在代码优先 EF 4.1 项目中使用 asp.net 会员资格提供程序,我该如何建立关系?例如,我有一个与用户表具有 1 对 n 关系的实体。
我想写这样的东西:
公共虚拟 ICollection 用户 { get;放; }
我如何在不创建自己的用户实体的情况下实现这一点
2) SQL Compact 是否包含 Membership Provider?
1) If i want to use the asp.net membership provider in a code first EF 4.1 project how can i make the relations? For example i have an entity which have a 1 to n relation to the User Table.
I want to write something like this:
public virtual ICollection Users { get; set; }
How can i realize this without making my own User Entity?
2) Does SQL Compact contain Membership Provider?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
由于您首先使用代码,因此您需要创建用户实体。
然后,您可以将此实体映射到
aspnet_Users
表,假设您已经 将成员数据库表安装到您的数据库中。最后,您需要映射其他实体与您刚刚创建的
User
之间的关系。Since you're using code first, you'll need to create the User Entity.
Then, you can map this entity to the
aspnet_Users
table, assuming you have already installed the membership database tables into your database.Finally, you need to map the relationships that other entities have with the
User
you just created.