当前位置:Gxlcms > 数据库问题 > EF6:在多语句事务内不允许使用 CREATE DATABASE 语句

EF6:在多语句事务内不允许使用 CREATE DATABASE 语句

时间:2021-07-01 10:21:17 帮助过:14人阅读

/ Application. 在多语句事务内不允许使用 CREATE DATABASE 语句。 Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Data.SqlClient.SqlException: 在多语句事务内不允许使用 CREATE DATABASE 语句。 Source Error: Line 32: */ Line 33: public ZmBlogDbContext(string nameOrConnectionString) Line 34: : base(nameOrConnectionString) Line 35: { Line 36:

二、解决方法
这是 EF 抛出的异常,只要先创建好数据库就可以了

create database [ZmBlog]

 

提示:

这个错误是在第一次运行abp出现的,创建数据库后,这时要使用 update-database 进行数据迁移,否则基础数据是空的

 

EF6:在多语句事务内不允许使用 CREATE DATABASE 语句

标签:ase   ext   webkit   string   space   date   log   during   weight   

人气教程排行