开发者

Entity Framework 4 CTP 5 Code First Development

I am trying to do some tests using EF4 + CTP5 with code first development by writing POCO classes and have faced the following problems

  1. Connecting to existing database throws me the exception:

    Model compatibility cannot be checked because the database does not contain model metadata

  2. While I can create a new database from code by giving a new file name in a connection string, not able to open the file (database) using the Management Studio after running few te开发者_StackOverflow社区sts against, the Management studio doesn't allow to add the file when trying to attach the database with no specific error detail provided.


For #1, did you try adding the following to your global.asax?

Database.SetInitializer<CustomContextNameHere>(null);

where "CustomContextNameHere" is your context object.

As far as #2 goes, I am assuming you mean the default ASPNETDB.MDF file. Have you tried opening the file with the Server Explorer in VS? It may open right up if you double-click on it in the solution.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜