Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-apps-script/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Nhibernate ';指数';和';列表索引';_Nhibernate - Fatal编程技术网

Nhibernate ';指数';和';列表索引';

Nhibernate ';指数';和';列表索引';,nhibernate,Nhibernate,对于NHibernate中具有有序集合(如列表)的集合映射,必须映射索引列字段。我刚刚注意到,在NHibernate2.0中,似乎还有一个“列表索引”属性,我相信它可以用来代替索引 避免使用“列表索引”指定基本索引值,两者之间有区别吗?使用一个与另一个相比有什么好处?通过查看XSD,我可以看出索引支持指定一个类型和多个列,因此它可能可以与自定义类型一起使用(我没有尝试过)我有同样的问题并阅读了代码。我发现: (NH 3.0,Cfg\Collection Binder.cs,#548) 这对我来说

对于NHibernate中具有有序集合(如列表)的集合映射,必须映射索引列字段。我刚刚注意到,在NHibernate2.0中,似乎还有一个“列表索引”属性,我相信它可以用来代替索引


避免使用“列表索引”指定基本索引值,两者之间有区别吗?使用一个与另一个相比有什么好处?

通过查看XSD,我可以看出
索引
支持指定一个
类型和多个
,因此它可能可以与自定义类型一起使用(我没有尝试过)

我有同样的问题并阅读了代码。我发现:

(NH 3.0,Cfg\Collection Binder.cs,#548)

这对我来说意味着:

  • 基本上是一样的
  • 列表索引
    覆盖
    索引
  • 索引的类型设置为
    int
    。因此,您必须检查在映射文件中使用其他类型时实际发生的情况
  • list index
    支持
    base
    告诉它从哪个索引开始。(这是在其他地方找到的)
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);
    }
    // ...
}