これは古い質問であることは理解していますが、答えはEF 6の問題を解決しませんでした.
EF 6 の場合、ComplexTypeConfiguration マッピングを作成する必要があります。
例:
public class Workload
{
public int Id { get; set; }
public int ContractId { get; set; }
public WorkloadStatus Status {get; set; }
public Configruation Configuration { get; set; }
}
public class Configuration
{
public int Timeout { get; set; }
public bool SaveResults { get; set; }
public int UnmappedProperty { get; set; }
}
public class WorkloadMap : System.Data.Entity.ModelConfiguration.EntityTypeConfiguration<Workload>
{
public WorkloadMap()
{
ToTable("Workload");
HasKey(x => x.Id);
}
}
// Here This is where we mange the Configuration
public class ConfigurationMap : ComplexTypeConfiguration<Configuration>
{
ConfigurationMap()
{
Property(x => x.TimeOut).HasColumnName("TimeOut");
Ignore(x => x.UnmappedProperty);
}
}
Context が構成を手動でロードしている場合は、新しい ComplexMap を追加する必要があります。FromAssembly オーバーロードを使用している場合は、残りの構成オブジェクトと共に取得されます。