我修改了如下所示的表格
ALTER TABLE [Plant]
ADD
Name nvarchar(128) NULL,
GLN nvarchar(15) NULL,
LicenceInformation nvarchar(1024) NULL,
MondayStart smallint NULL,
MondayEnd smallint NULL,
TuesdayStart smallint NULL,
TuesdayEnd smallint NULL,
WednesdayStart smallint NULL,
WednesdayEnd smallint NULL,
ThursdayStart smallint NULL,
ThursdayEnd smallint NULL,
FridayStart smallint NULL,
FridayEnd smallint NULL,
SaturdayStart smallint NULL,
SaturdayEnd smallint NULL,
SundayStart smallint NULL,
SundayEnd smallint NULL
我想映射到类似的东西:
public class Plant : ProjectAggregateRootEntity<int>
{
public virtual string Code { get; set; }
public virtual string Name { get; set; }
public virtual string Gln { get; set; }
public virtual string LicenceInformation { get; set; }
public virtual IDictionary<DayOfWeek, PlantOpeningHours> OpeningHours
{
get; set;
}
}
public class PlantOpeningHours
{
public virtual DayOfWeek Day { get; set; }
public virtual int StartMinutes { get; set; }
public virtual int DurationMinutes { get; set; }
}
所以我可以列举每天的营业时间或具体参考一个:plant.OpeningHours[DayOfWeek.Monday]
所以它有点像组件映射......但不完全是。
Cache.ReadWrite().Region("ReferenceData");
Table("Plant");
Map(x => x.Code);
Map(x => x.Name);
Map(x => x.Gln);
Map(x => x.LicenceInformation);
Component(x => x.OpeningHours, x =>
{
//??
});