我无法创建新的迁移Add-Migration Testing
Microsoft.AspNet.WebApi - > 5.0.0-beta1-130515
Microsoft.AspNet.WebApi.Client - > 5.0.0-beta1-130515
Microsoft.AspNet.WebApi.Core - > 5.0.0-beta1-130515
Microsoft.AspNet.WebApi.OData - > 5.0.0-beta1-130515
Microsoft.AspNet.WebApi.Web ... - > 5.0.0-beta1-130515
当我尝试创建新迁移时,会发生以下错误:
PM>添加迁移测试System.Data.Entity.Core.MappingException: 指定的架构无效。错误:(0,0):错误 2025:映射架构的XML架构验证失败。架构错误 信息: 'http://schemas.microsoft.com/ado/2012/10/edm/migrations:IsSystem' 属性未声明..(0,0):错误2025:XML 映射架构的架构验证失败。架构错误信息 :The 'http://schemas.microsoft.com/ado/2012/10/edm/migrations:IsSystem' 属性未声明..(0,0):错误2025:XML 映射架构的架构验证失败。架构错误信息 :The 'http://schemas.microsoft.com/ado/2012/10/edm/migrations:IsSystem' 属性未声明..(0,0):错误2025:XML 映射架构的架构验证失败。架构错误信息 :The 'http://schemas.microsoft.com/ado/2012/10/edm/migrations:IsSystem' 属性未声明..(0,0):错误2025:XML 映射架构的架构验证失败。架构错误信息 :The 'http://schemas.microsoft.com/ado/2012/10/edm/migrations:IsSystem' 属性未声明..(0,0):错误2025:XML 映射架构的架构验证失败。架构错误信息 :The 'http://schemas.microsoft.com/ado/2012/10/edm/migrations:IsSystem' 属性未声明..(0,0):错误2025:XML 映射架构的架构验证失败。架构错误信息 :The 'http://schemas.microsoft.com/ado/2012/10/edm/migrations:IsSystem' 属性未声明.. at System.Data.Entity.Core.Mapping.StorageMappingItemCollection.Init(EdmItemCollection edmCollection,StoreItemCollection storeCollection,IEnumerable
1 xmlReaders, IList
1 filePaths,Boolean throwOnError)at System.Data.Entity.Core.Mapping.StorageMappingItemCollection..ctor(EdmItemCollection edmCollection,StoreItemCollection storeCollection,IEnumerable`1 xmlReaders)at System.Data.Entity.Utilities.XDocumentExtensions.GetStorageMappingItemCollection(的XDocument model,DbProviderInfo& providerInfo)at System.Data.Entity.Migrations.Infrastructure.EdmModelDiffer.Diff(的XDocument sourceModel,XDocument targetModel,ModificationCommandTreeGenerator modificationCommandTreeGenerator,MigrationSqlGenerator migrationSqlGenerator)at System.Data.Entity.Migrations.DbMigrator.Scaffold(字符串 migrationName,String namespace,Boolean ignoreChanges)at System.Data.Entity.Migrations.Design.MigrationScaffolder.Scaffold(字符串 migrationName,Boolean ignoreChanges)at System.Data.Entity.Migrations.Design.ToolingFacade.ScaffoldRunner.Scaffold(MigrationScaffolder 脚手架) System.Data.Entity.Migrations.Design.ToolingFacade.ScaffoldRunner.Run() 在System.AppDomain.DoCallBack(CrossAppDomainDelegate callBackDelegate)at System.AppDomain.DoCallBack(CrossAppDomainDelegate callBackDelegate)
在System.Data.Entity.Migrations.Design.ToolingFacade.Run(BaseRunner) 跑者) System.Data.Entity.Migrations.Design.ToolingFacade.Scaffold(字符串 migrationName,String language,String rootNamespace,Boolean ignoreChanges)at System.Data.Entity.Migrations.AddMigrationCommand.Execute(String name, 布尔力,布尔值ignoreChanges)at System.Data.Entity.Migrations.AddMigrationCommand<> C_ DisplayClass2< .ctor&GT,B _0() 在 System.Data.Entity.Migrations.MigrationsDomainCommand.Execute(动作 命令)
代码非常广泛。这些是最后改变的类。
public class Entidade : EntityNome, IAuditavel
{
public DateTime CriadoAs { get; set; }
public virtual Usuario CriadoPor { get; set; }
public DateTime? AtualizadoAs { get; set; }
public virtual Usuario AtualizadoPor { get; set; }
}
public class Empresa : Entidade
{
public string RazaoSocial { get; set; }
public string CNPJ { get; set; }
public string InscricaoEstadual { get; set; }
public string WebSite { get; set; }
public virtual ICollection<Pessoa> Representantes { get; set; }
public virtual Pessoa Contato { get; set; }
public virtual ICollection<Telefone> Telefones { get; set; }
public virtual ICollection<Endereco> Enderecos { get; set; }
public virtual ICollection<Email> Emails { get; set; }
}
public class Agencia : Empresa
{
public string Identificacao { get; set; }
public virtual Regional Regional { get; set; }
public virtual ICollection<Pessoa> Gerentes { get; set; }
}
public class Regional : EntityNome
{
public virtual ICollection<Pessoa> Contatos { get; set; }
}
public class EntidadeConfiguracao : EntityTypeConfiguration<Entidade>
{
public EntidadeConfiguracao()
{
Property(p => p.Nome).IsName(true);
HasRequired(p => p.CriadoPor).WithMany().WillCascadeOnDelete(false);
ToTable("Entidades");
}
}
public class EmpresaConfiguracao : EntityTypeConfiguration<Empresa>
{
public EmpresaConfiguracao()
{
HasMany(p => p.Telefones).WithMany().Map(m => m.ToTable("EmpresaTelefones"));
HasMany(p => p.Emails).WithMany().Map(m => m.ToTable("EmpresaEmails"));
HasMany(p => p.Enderecos).WithMany().Map(m => m.ToTable("EmpresaEnderecos"));
HasMany(p => p.Representantes).WithMany().Map(m => m.ToTable("EmpresaRepresentantes"));
ToTable("Empresas");
}
}
public class AgenciaConfiguracao : EntityTypeConfiguration<Agencia>
{
public AgenciaConfiguracao()
{
HasRequired(p => p.Regional).WithMany().WillCascadeOnDelete(true); //.HasForeignKey(p => p.RegionalId)
Property(p => p.Identificacao).IsRequired().HasMaxLength(10);
HasMany(p => p.Gerentes).WithMany().Map(m => m.ToTable("AgenciaGerentes"));
ToTable("Agencias");
}
}
public class RegionalConfiguracao : EntityTypeConfiguration<Regional>
{
public RegionalConfiguracao()
{
Property(p => p.Nome).IsName(true);
HasMany(p => p.Contatos).WithMany().Map(m => m.ToTable("RegionalContatos"));
ToTable("Regionais");
}
}
答案 0 :(得分:1)
您需要重新创建迁移。请查看EF6 Beta1 announcement
中的“您需要了解的事项”部分以下是EF codeplex网站上的相关work item。