我有一个包含值对象列表的对象,但无法找到如何流畅地映射此对象的解决方案。我有一个值对象映射为getNamedItem(attributeName)
(没有内联映射),如下所示:
ComponentMap
包含类的定义如下:
public class ServiceSpecificationMapping : ComponentMap<ServiceSpecification>
{
public ServiceSpecificationMapping()
{
Map(x => x.PurposeOfService).Not.Nullable();
Map(x => x.Description).Nullable();
Map(x => x.Price).Not.Nullable();
}
我很难编写正确的映射。我正在寻找类似的东西:
public class ServiceContract : EntityBase
{
....
public virtual List<ServiceSpecification> ServiceSpecifications { get; set; }
...
}
我需要引用HasMany<ServiceSpecification>(x => x.ServiceSpecifications)
.Table("tblServiceSpecification")
.Component(<WHAT IS THE CORRECT LAMBDA HERE??>);
实例,但我找不到正确的语法。任何帮助将不胜感激。
答案 0 :(得分:1)
HasMany<ServiceSpecification>(x => x.ServiceSpecifications)
.Table("tblServiceSpecification")
.Component(m => {
m.Map(x => x.PurposeOfService).Not.Nullable();
m.Map(x => x.Description).Nullable();
m.Map(x => x.Price).Not.Nullable();
});