添加迁移错误:指定的架构无效
本文关键字:无效 迁移 错误 添加 | 更新日期: 2023-09-27 18:13:57
我不能创建一个新的迁移Add-Migration Testing
Microsoft.AspNet。WebApi -> 5.0.0-beta -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……->
当我尝试创建一个新的迁移时,出现以下错误:
<标题> 代码PM> Add-Migration Testing System.Data.Entity.Core.MappingException:指定的架构无效。Errors:(0,0):错误2025:映射模式的XML模式验证失败。模式错误信息:"http://schemas.microsoft.com/ado/2012/10/edm/migrations: IsSystem"属性未声明。(0,0): error 2025: XML映射模式的模式验证失败。架构错误信息:"http://schemas.microsoft.com/ado/2012/10/edm/migrations: IsSystem"属性未声明。(0,0): error 2025: XML映射模式的模式验证失败。架构错误信息:"http://schemas.microsoft.com/ado/2012/10/edm/migrations: IsSystem"属性未声明。(0,0): error 2025: XML映射模式的模式验证失败。架构错误信息:"http://schemas.microsoft.com/ado/2012/10/edm/migrations: IsSystem"属性未声明。(0,0): error 2025: XML映射模式的模式验证失败。架构错误信息:"http://schemas.microsoft.com/ado/2012/10/edm/migrations: IsSystem"属性未声明。(0,0): error 2025: XML映射模式的模式验证失败。架构错误信息:"http://schemas.microsoft.com/ado/2012/10/edm/migrations: IsSystem"属性未声明。(0,0): error 2025: XML映射模式的模式验证失败。架构错误信息:"http://schemas.microsoft.com/ado/2012/10/edm/migrations: IsSystem"属性未声明。在System.Data.Entity.Core.Mapping.StorageMappingItemCollection.Init (EdmItemCollectionedmCollection, StoreItemCollection, storerecollection, IEnumerable
1 xmlReaders, IList
1 fileppaths, Boolean throwOnError) atSystem.Data.Entity.Core.Mapping.StorageMappingItemCollection . .男星(EdmItemCollection{{{{}} {{}} {{}}xmlreader)System.Data.Entity.Utilities.XDocumentExtensions.GetStorageMappingItemCollection (XDocument模型,DbProviderInfo&providerInfo)System.Data.Entity.Migrations.Infrastructure.EdmModelDiffer.Diff (XDocumentsourceModel, XDocument, targetModel, ModificationCommandTreeGeneratormodificationCommandTreeGenerator, MigrationSqlGeneratormigrationSqlGenerator)System.Data.Entity.Migrations.DbMigrator.Scaffold(字符串migrationName,字符串命名空间,布尔值System.Data.Entity.Migrations.Design.MigrationScaffolder.Scaffold(字符串migrationName, Boolean, ignoreChanges) atSystem.Data.Entity.Migrations.Design.ToolingFacade.ScaffoldRunner.Scaffold (MigrationScaffolder架子工)System.Data.Entity.Migrations.Design.ToolingFacade.ScaffoldRunner.Run ()System.AppDomain.DoCallBack (CrossAppDomainDelegatecallBackDelegate)System.AppDomain。DoCallBack (CrossAppDomainDelegate callBackDelegate)
System.Data.Entity.Migrations.Design.ToolingFacade.Run (BaseRunner跑步者)System.Data.Entity.Migrations.Design.ToolingFacade.Scaffold(字符串migrationName,字符串语言,字符串rootNamespace,布尔值ignoreChanges)System.Data.Entity.Migrations.AddMigrationCommand。执行(字符串名称,Boolean force, Boolean ignoreChanges) atSystem.Data.Entity.Migrations.AddMigrationCommand灵活;> c_ DisplayClass2灵活;.ctor 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");
}
}
发表于aspnetwebstack issue
标题>标题>标题>您需要重新创建迁移。看看EF6 Beta1公告中的"你需要知道的事情"部分
这是EF codeplex站点上的一个相关工作项