Visual Studio 2012를 사용하고 있으며 EF 6에서 Entity Framework 스택을 사용하고 있습니다. 마이그레이션을 추가하는 동안 모두 올바른 작업을 수행했지만 오류. 여기 SQL Server 2012를 사용하는 Entity Framework 6은 System.Data.Entity.Core.ProviderIncompatibleException을 제공합니다.
는 클래스System.Data.Entity.Core.ProviderIncompatibleException
public class Order
{
public virtual int OrderID { get; set; }
}
컨텍스트 파일
public ShoppingCartContext() : base("ShoppingCartDb")
{
Database.SetInitializer<ShoppingCartContext>(new DropCreateDatabaseAlways<ShoppingCartContext>());
}
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
#region Entity Framework 6 RC-1
modelBuilder.Properties().Where(x => x.Name == x.DeclaringType.ToString() + "ID")
.Configure(x => x.IsKey());
modelBuilder.Properties<DateTime>()
.Configure(x => x.HasColumnType("datetime2"));
#endregion
modelBuilder.Conventions.Remove<PluralizingTableNameConvention>();
base.OnModelCreating(modelBuilder);
}
그리고 오류 때마다 점점 오전
<connectionStrings>
<add name="ShoppingCartDb"
connectionString="Server=Localhost;Database=ShoppingCartEfDb;User Id=sa;Password=xxxxxxxxxx"
providerName="System.Data.SqlClient" />
</connectionStrings>
을 connctionstring의 web.config 파일 섹션입니다 나는 노력하고있다. g로 마이그레이션을 추가하려면 다음을 입력하십시오.
System.Data.Entity.Core.ProviderIncompatibleException: An error occurred while getting provider information from the database. This can be caused by Entity Framework using an incorrect connection string. Check the inner exceptions for details and ensure that the connection string is correct. ---> System.Data.Entity.Core.ProviderIncompatibleException: The provider did not return a ProviderManifestToken string. --->
System.Data.SqlClient.SqlException: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
'base ("ShoppingCartDb")'대신'base ("name = ShoppingCartDb")'를 사용하지 않아야합니까? – Pawel