尝试使用两个相同的子类映射订单类并出现以下错误
Could not find a getter for property 'RatingCriteria1' in class 'ORM.Entities.Enquiry.EnquiryOrder'
基本上我在数据库中有一个包含很多列的表。12 列与评级相关
BuyerRatingCriteria1、BuyerRatingCriteria2、BuyerRatingCriteria3、BuyerRatingCriteria4、BuyerRatingCriteria5、BuyerRatingCriteriaComments
和
SupplierRatingCriteria1, SupplierRatingCriteria2, SupplierRatingCriteria3, SupplierRatingCriteria4, SupplierRatingCriteria5, SupplierRatingCriteriaComments
我想将它们简化为两个子类,以便我拥有
Order.SupplierRating.Criteria1
和
Order.BuyerRating.Criteria1
例如
public class EnquiryOrder : Entity
{
public virtual int Id { get; set; }
public virtual DateTime DateOrdered { get; set; }
public virtual string PONumber { get; set; }
public virtual string SONumber { get; set; }
public virtual Rating SupplierRatings { get; set; }
public virtual Rating BuyerRatings { get; set; }
}
public class Rating : Entity
{
public virtual int RatingCriteria1 { get; set; }
public virtual int RatingCriteria2 { get; set; }
public virtual int RatingCriteria3 { get; set; }
public virtual int RatingCriteria4 { get; set; }
public virtual int RatingCriteria5 { get; set; }
public virtual string RatingCriteriaComment { get; set; }
}
映射我认为会像这样简单
public EnquiryOrderMapping()
{
Id(x => x.Id).Column("EnquiryOrderId");
Map(x => x.DateOrdered);
Map(x => x.PONumber).Nullable();
Map(x => x.SONumber).Nullable();
Map(x => x.BuyerRatings.RatingCriteria1).Column("EnquiryBuyerRatingsRatingCriteria1").Nullable();
Map(x => x.BuyerRatings.RatingCriteria2).Column("EnquiryBuyerRatingsRatingCriteria2").Nullable();
Map(x => x.BuyerRatings.RatingCriteria3).Column("EnquiryBuyerRatingsRatingCriteria3").Nullable();
Map(x => x.BuyerRatings.RatingCriteria4).Column("EnquiryBuyerRatingsRatingCriteria4").Nullable();
Map(x => x.BuyerRatings.RatingCriteria5).Column("EnquiryBuyerRatingsRatingCriteria5").Nullable();
Map(x => x.BuyerRatings.RatingCriteriaComment).Column("EnquiryBuyerRatingsRatingCriteriaComment").Nullable();
}
不,我没有在这里映射供应商方面,因为我试图尽可能地简化它以便能够解决它。
所以我不明白为什么它有问题......我已经告诉它看哪一列(全名)而不是“RatingCriteria1”
以及当我确实有一个变量 RatingCriteria1 时,它有一个 getter 和 setter !!!
很奇怪...在映射这样的子类时,我是否遗漏了您必须做的事情?