#!_MVC数据库连接访问与生成问题

来源:互联网 发布:php正则表达式 编辑:程序博客网 时间:2024/06/08 07:16
MVC里自己建立数据库访问,出现数据库错误:
Model compatibility cannot be checked because the database does not contain
model metadata. Model compatibility can only be checked for databases created
using Code First or Code First Migrations.
百度无果,隔日Google英文~~
解决方案:
command in Package Manager Console.
1.PM>Enable-Migrations
或者还可以:

2.PM> add-migration Initial
    
3.PM> Update-Database

问题搞定,生成数据库,还是国外程序员牛逼!
 
ps:
注意首先要在生成的空数据库里建一个EdmMetadata表。
原创粉丝点击