0
這一定是簡單的事情,我無法掌握的地方。多對一映射不允許財產
說一個企業提供多種服務。業務一方面,ServiceOffers作爲查找表和一個BusinessServiceOffers關聯。當我添加如下的多對一映射時,sqlite提供者(單元測試)拋出一個參數超出範圍異常,可以理解的是由於Property和ManyToOne中的重複引用。
Property(x => x.ServiceOfferingId);
ManyToOne
(
x => x.ServiceOffering,
x =>
{
x.Fetch(FetchKind.Select);
x.Lazy(LazyRelation.Proxy);
x.Column("ServiceOfferingId");
x.ForeignKey("FK_BusinessServiceOffering_ServiceOfferingId");
}
);
刪除屬性修復了異常問題,但測試保持失敗。展望插入SQL我看到像插入,而不是分配給INT值ServiceOfferingId「空」:
INSERT
INTO
BusinessServiceOffering
(BusinessId, IsEnabled, CreatedDate, CreatedByLoginId, ModifiedDate, ModifiedByLoginId, ServiceOfferingId, BusinessServiceOfferingId)
VALUES
(@p0, @p1, @p2, @p3, @p4, @p5, @p6, @p7);
@p0 = 200 [Type: Int32 (0)], @p1 = True [Type: Boolean (0)],
@p2 = 2/28/2013 6:11:25 PM [Type: DateTime (0)],
@p3 = 20 [Type: Int32 (0)], @p4 = 2/28/2013 6:11:25 PM [Type: DateTime (0)],
@p5 = 30 [Type: Int32 (0)], @p6 = **NULL** [Type: Int32 (0)], --->
@p7 = 5 [Type: Int32 (0)]
我試圖在「一」方增加一個袋子,但似乎沒有任何區別。
我錯過了什麼?請注意,我已經可以使用或不使用該屬性的sql server進行集成測試。但是,使用sql server的簡單Read測試無法返回刪除屬性的那些字段的任何數據。
似乎我需要正確映射或它是一個sqlite特質。
請幫忙。