开发者

mvc3 and entity deployment - Will Entity create tables?

I'm super new to all this, so this may be a silly question.

I'm deploying a mvc3 app. Locally I have two databases, one came built in and contains the users/membership/roles, etc the other is for my dbcontext.

Local connection:

<connectionStrings>
<add name="ApplicationServices" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirector开发者_开发问答y|aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient"/>
<add name="MembershipExtContext" connectionString="Data Source=|DataDirectory|invoice.sdf" providerName="System.Data.SqlServerCe.4.0"/>
</connectionStrings>

I need to deploy to (preferably) one database catalog. How do I do this? Do I need two catalogs? Will Entity still create the tables and such?

I was given a connection string for the new database.

I'm very confused. I hope someone can help.

The database on the server is sql2005. I am using entity code first.


You will need a connectionString for ASP.NET membership, and another for EF. It's fine if both point to the same DB.

Yes, you can use EF's DB initializer to create DB tables if you like, but it cannot create the membership tables. For that, you need to use aspnet_regsql.exe. The built in DB initialization strategies won't support evolving a schema in place, however. So you must either first create EF tables with your model and then run aspnet_regsql.exe before logging in or, perhaps preferably, use something like the forthcoming code-first migrations or the database generation power pack to evolve the DB schema in place.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜