Tôi có cùng một câu hỏi và đọc mã. Tôi thấy như sau:
(NH 3.0, CFG \ Collection Binder.cs, # 548)
private void BindCollectionIndex(/*...*/)
{
// ...
if (listMapping.ListIndex != null)
{
iv = new SimpleValue(model.CollectionTable);
new ValuePropertyBinder(iv, Mappings).BindSimpleValue(
listMapping.ListIndex,
IndexedCollection.DefaultIndexColumnName,
model.IsOneToMany);
}
else if (listMapping.Index != null)
{
iv = new SimpleValue(model.CollectionTable);
listMapping.Index.type = NHibernateUtil.Int32.Name;
new ValuePropertyBinder(iv, Mappings).BindSimpleValue(
listMapping.Index,
IndexedCollection.DefaultIndexColumnName,
model.IsOneToMany);
}
// ...
}
Có nghĩa là với tôi:
- Nó là cơ bản giống nhau.
list-index
ghi đè index
- Các loại
index
được thiết lập để int
. Vì vậy, bạn phải kiểm tra những gì thực sự xảy ra khi sử dụng một loại khác trong tệp ánh xạ.
list-index
hỗ trợ base
để cho biết chỉ mục nào sẽ bắt đầu. (Điều này được tìm thấy ở một nơi khác)
Nguồn
2012-03-19 10:35:22