我对被审计物体有一个基级:
http://www.ohchr.org。
public class AuditableObject : DomainObject, IAuditable
{
... some fields
public AuditInfo AuditInfo
{
get;
set;
}
}
<>AuditInfo
public class AuditInfo : IAuditable
{
public int CreatedByDbId
{
get;
set;
}
public DateTime CreatedDate
{
get;
set;
}
public int? AmendedByDbId
{
get;
set;
}
public DateTime? AmendedDate
{
get;
set;
}
}
The CreatedByDbId and A amendedByDb Id与系统User物体有关:
<>SystemUser
public class SystemUser
{
public int SystemUserDbId
{
get;
set;
}
public string Username
{
get;
set;
}
}
我有一个等级:<>Call,继承来自可审计物体的遗产,该系统还拥有其他特性:
public class Call : AuditableObject
{
... some fields
public SystemUser TakenBy { get; set;}
public SystemUser CreatedBy { get; set; }
public SystemUser CancelledBy { get; set;}
public int CancelledByDbId {get; set;}
public int TakenByDbId { get; set;}
}
www.un.org/Depts/DGACM/index_spanish.htm 电话数据库表
CREATE TABLE [dbo].[Call](
[CallDbId] [int] IDENTITY(1,1) NOT NULL,
[CancelledBy] [int] NULL,
[CreatedByDbId] [int] NOT NULL,
[CreatedDate] [datetime] NOT NULL,
[AmendedByDbId] [int] NULL,
[AmendedDate] [datetime] NULL,
[TakenBy] [int] NOT NULL)
我似乎无法正确绘制地图,例如。
modelBuilder.ComplexType<AuditInfo>();
...// configuration for Call
this.Property(x => x.AuditInfo.AmendedByDbId).HasColumnName("AmendedByDbId");
this.Property(x => x.AuditInfo.AmendedDate).HasColumnName("AmendedDate");
this.Property(x => x.AuditInfo.CreatedByDbId).HasColumnName("CreatedByDbId");
this.Property(x => x.AuditInfo.CreatedDate).HasColumnName("CreatedDate");
this.Property(t => t.CancelledByDbId).HasColumnName("CancelledBy");
this.Property(t => t.TakenByDbId).HasColumnName("TakenBy");
this.HasRequired(t => t.TakenBy).WithMany().HasForeignKey(x => x.TakenByDbId);
this.HasRequired(t => t.CancelledBy).WithMany().HasForeignKey(x => x.CancelledByDbId);
并且我总是在运行时出现错误,例如:
Invalid column name SystemUser_SystemUserDbId .
Invalid column name SystemUser_SystemUserDbId1 .
Invalid column name SystemUser_SystemUserDbId2 .
Invalid column name CreatedBy_SystemUserDbId .
我可以 figure一 figure一 figure: