使用.NET成员资格提供结合实体框架4.3迁移实体、框架、成员、资格

2023-09-06 17:47:16 作者:泡芙

我工作的一个应用程序,到目前为止,我们已经通过管理实体框架4.3 code数据库和域先用迁移...

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...

由于这里看到的... http://blogs.msdn.com/b/adonet/archive/2012/02/09/ef-4-3-$c$c-based-migrations-walkthrough.aspx

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

我们已经开始需要实现会员的点,是想利用.NET成员提供。在过去,我刚才用aspnet_regsql.exe的生成数据库中所有的成员表。有没有办法让它所以这些成员表,在数据库中保存生成的迁移的一个组成部分?

We have come to the point of needing to implement membership and are wanting to use .NET Membership provider. In the past I have just used aspnet_regsql.exe to generate all the membership tables in the database. Is there a way to make it so these membership tables get generated in the database as part of one of the migrations?

推荐答案

也许你可以使用类SqlServices安装服务:

Maybe you can use the class SqlServices to install the services:

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

例如:

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

我希望我是有帮助的。

I hope I was helpful.