在 EF CodeFirst 中使用成员资格提供程序

发布于 2025-01-04 04:31:49 字数 253 浏览 1 评论 0原文

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

人事已非 2025-01-11 04:31:49

由于您首先使用代码,因此您需要创建用户实体。
然后,您可以将此实体映射到 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文