Nachdem ich mein Modell gebaut haben möchte ich es überprüfen, so versuche ich EntityFramework Power-Tools zu verwenden, um das Modell visuell zu bekommen, aber ich erhalte den folgenden Fehler:Der Typ 'XXX' konnte nicht von der Baugruppe 'XXX' geladen werden. at.OnModelCreating (DbModelBuilder Modelbuilder)
System.Reflection .TargetInvocationException: Exception wurde vom Ziel eines Aufrufs ausgelöst. ---> System.TypeLoadException: Konnte nicht laden Typ 'DomainClasses.CompanyLogo' von Assembly 'DomainClasses, Version = 1.0.0.0, Kultur = neutral, PublicKeyToken = null'. bei DataLayer.FinanceModelContext.OnModelCreating (DbModelBuilder Modelbuilder) bei System.Data.Entity.Internal.LazyInternalContext.CreateModelBuilder()
bei System.Data.Entity.Internal.LazyInternalContext.CreateModel (LazyInternalContext internalContext) bei -System .Data.Entity.Internal.RetryLazy`2.GetValue (TInput Eingang) bei System.Data.Entity.Internal.LazyInternalContext.InitializeContext()
bei System.Data.Entity.Internal.LazyInternalContext.get_ModelBeingInitialized() bei System.Data.Entity.Infrastructure.EdmxWriter.WriteEdmx (DbContext
My Domain-Klasse, die die Fehler verursachen:
namespace DomainClasses
{
public class CompanyLogo
{
public byte[] Logo { get; set; }
public int CompanyId { get; set; }
public virtual Company Company { get; set; }
}
}
die Konfigurationsdatei:
public class CompanyLogoMappings:EntityTypeConfiguration<CompanyLogo>
{
public CompanyLogoMappings()
{
this.HasKey(c => c.CompanyId);
this.HasRequired(c => c.Company).WithOptional(cl => cl.CompanyLogo);
}
}
Haben Sie CompanyLogoMappings zu Konfigurationen hinzugefügt? –
@AdilMammadov: yeah 'modelBuilder.Configurations.Add (new CompanyLogoMappings());' aber ich weiß nicht, warum dieser Fehler –