EF6: CREATE DATABASE statement is not allowed within a multi-statement transaction

Source: Internet
Author: User
Tags stack trace

First, the question

Using EF codefirst Development, unable to create database problems, the following tips

Server Errorinch '/'application. CREATE DATABASE statements are not allowed within a multi-statement transaction. Description:an unhandled exception occurred during the execution of the current Web request. Please review the stack trace forMore information about the error andwhereIt originatedinchThe code. Exception Details:System.Data.SqlClient.SqlException: The CREATE DATABASE statement is not allowed within a multi-statement transaction. Source Error:line +:          */ Line -: PublicZmblogdbcontext (stringnameorconnectionstring) Line the:             :Base(nameorconnectionstring) Line *: { line $:

Second, the solution
This is the exception that EF throws, as long as you create the database first.

Create DATABASE [Zmblog]

Tips:

This error occurs when the ABP is first run, and after the database is created, the data is migrated using Update-database, otherwise the underlying data is empty

EF6: CREATE DATABASE statement is not allowed within a multi-statement transaction

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.