前段时间客户数据服务器断电,开机后发现数据库状态标记为可疑,可能是断电引起的数据库日志文件损坏,修复方法如下: 只有mdf文件,重建日志: --注:example为测试用数据库,相应的Example_log.ldf为测试用的日志文件 use master go alter database example set emergency go --置数据库为单用户模式 alter database example set single_user with rollback immediate go…
在操作已经创建好的数据库时,若是添加新的实体类或者修改原有数据库上下文,会报如下错误: The model backing the 'StudentDbContext' context has changed since the database was created. Consider using Code First Migrations to update the database(http://go.microsoft.com/fwlink/?LinkId=238269). 解决方法:…