English 中文(简体)
我如何将成员表与实体框架结合起来? Asp.net
原标题:How do I integrate Membership tables with Entity Framework? Asp.net

I have never used Entity Framework in a project before so I am not sure where to begin. I have I am using the membership tables that are created when using ASP.Net membership provider as is.

我想提出一个标语,其中提及用户。 例如

public int Id {get;set;}
public User User{get;set} // Where User is some object relating to Membership provider User.
public string Application {get; set;}

我在使用欧洲紧急部队时首先采用一种代码方法,因此我要让它根据这个目标编制表格。 因此,我是如何混淆这种说法的,以便欧洲复兴开发银行认识到,我正在与由英特网成员管理的用户建立联系? 在上述例子中,我应使用哪些类型的用户(例如,蚊帐类型)

如果情况模糊不清,则会问。 我基本上只需要一个实例或解释欧洲复兴开发银行如何与App.net成员提供方的表象相结合。

感谢!

最佳回答

如果你想要有一个连接您的会费表和申请表的EF模式,你可以加入伙伴关系。 利用现有数据库的网络成员表格,使用蚊帐_regsql.exe 。 一些联系:

Once you have the Membership tables installed, you can generate EF Code classes that match the membership schema. I posted a detailed walkthrough on how to do that here:

《欧洲刑法》 现有数据库的第一个模型类别

问题回答

I would say you could create an "AppUser"(Your own custom User object) Entity where the corresponding table has a foreign key to the "UserID" column of the aspnet_Membership table. This way it will be easier if you need to change or add properties to your "AppUser" Entity instead of trying to change the MS table structure (which can be a real pain). You can still interact with the built-in MS Membership classes and functions from your MVC project using something like the MvcMembership starter Kit DLL s.

https://github.com/TroyGoode/MembershipStarterKit

希望这一帮助!





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Transaction handling with TransactionScope

I am implementing Transaction using TransactionScope with the help this MSDN article http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx I just want to confirm that is ...

System.Web.Mvc.Controller Initialize

i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...

Microsoft.Contracts namespace

For what it is necessary Microsoft.Contracts namespace in asp.net? I mean, in what cases I could write using Microsoft.Contracts;?

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签