流利地映射一组组件
Fluently map a collection of components
我有一个包含 值对象列表 的对象,但找不到如何流畅地映射它的解决方案。我有一个映射为 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();
}
包含class的定义是这样的:
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??>);
我需要引用 ServiceSpecification
实例,但找不到正确的语法。任何帮助将不胜感激。
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();
});
我有一个包含 值对象列表 的对象,但找不到如何流畅地映射它的解决方案。我有一个映射为 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();
}
包含class的定义是这样的:
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??>);
我需要引用 ServiceSpecification
实例,但找不到正确的语法。任何帮助将不胜感激。
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();
});