我越來越城堡活動記錄(NHibernate的周圍包裹)這個討厭的錯誤,當我試圖保存類:無效指數n此SqlParameterCollection以計數= M
無效指數n此SqlParameterCollection以計數= m
我知道這個錯誤是由一個屬性在一個類中多次映射引起的,但我不確定如何避開它。我有兩個子類,它們都使用相同的列(IpAddressNumber)映射回有問題的類。此外IpAddressNumber是類的主鍵,這將導致NHibernate的嘗試將IpAddressNumber財產三次地圖(僅僅是猜測。)
這裏是類:
[ActiveRecord(Lazy=true)]
public class DeviceConfiguration : UsersDatabase<DeviceConfiguration>
{
[PrimaryKey]
public virtual long IPAddressNumber { get; set; }
[BelongsTo("IPAddressNumber", Lazy = FetchWhen.OnInvoke)]
public virtual Vehicle Vehicle { get; set; }
[BelongsTo("IPAddressNumber", Lazy = FetchWhen.OnInvoke)]
public virtual JBusConfiguration JBusConfiguration { get; set; }
}
任何幫助將不勝感激...
這看起來像一個數據庫設計問題......您是否使用表來存儲IP? – 2011-02-23 21:01:53
不,我刪除了DeviceConfiguration的其他屬性以顯示相關的關聯。有兩個子表都基於它的PK引用一個父表不似乎是一個數據庫設計問題... – Justin 2011-02-23 21:32:48
如果這是直接NHibernate,這是將使用配置,其中你有一個1 :父表和子表之間的關係1,對嗎?唯一的問題是ActiveRecord如何支持1:1關係。 –
Rich
2011-02-23 22:52:08