简体   繁体   English

将.Net成员资格提供程序与Entity Framework 4.3迁移结合使用

[英]Using .Net Membership Provider in conjunction with Entity Framework 4.3 migrations

I'm working on an application where so far we have been managing the database and domain via Entity Framework 4.3 code first with migrations... 我正在开发一个应用程序,到目前为止,我们通过Entity Framework 4.3代码首先通过迁移来管理数据库和域...

As seen here... http://blogs.msdn.com/b/adonet/archive/2012/02/09/ef-4-3-code-based-migrations-walkthrough.aspx 如此处所示... http://blogs.msdn.com/b/adonet/archive/2012/02/09/ef-4-3-code-based-migrations-walkthrough.aspx

We have come to the point of needing to implement membership and are wanting to use .NET Membership provider. 我们已经到了需要实现成员资格并希望使用.NET成员资格提供程序的程度。 In the past I have just used aspnet_regsql.exe to generate all the membership tables in the database. 在过去,我刚刚使用aspnet_regsql.exe来生成数据库中的所有成员资格表。 Is there a way to make it so these membership tables get generated in the database as part of one of the migrations? 是否有办法使这些成员资格表在数据库中作为其中一个迁移的一部分生成?

Maybe you can use the class SqlServices to install the services: 也许你可以使用类SqlServices来安装服务:

http://msdn.microsoft.com/en-us/library/system.web.management.sqlservices.install.aspx http://msdn.microsoft.com/en-us/library/system.web.management.sqlservices.install.aspx

Example: 例:

SqlServices.Install ("databaseName", SqlFeatures.Membership, yourConnectionString); 
SqlServices.Install ("databaseName", SqlFeatures.RoleManager, yourConnectionString);

I hope I was helpful. 我希望我能提供帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM