我定义了一个实体,是用EF自动生成的数据库,我想在实体中加个字段,比如public string Price{get;set;}
直接生成会报错
The model backing the 'MovieDBContext' context has changed since the database was created. Either manually delete/update the database, or call Database.SetInitializer with an IDatabaseInitializer instance. For example, the DropCreateDatabaseIfModelChanges strategy will automatically delete and recreate the database, and optionally seed it with new data.
然后我想自己手动更改,于是我把数据库加了Price字段,然后在VS需要添加代码的地方也添加了,还是报错,难道EF也要更新,怎么更新
汗 一个2B的问题 不过是初学者
嘿嘿 直接SaveChanges()就可以了