Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7671075
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T15:58:00+00:00 2026-05-31T15:58:00+00:00

For collection mapping in NHibernate with ordered collections such as lists, an index column

  • 0

For collection mapping in NHibernate with ordered collections such as lists, an index column field must be mapped. I just noticed that, as of NHibernate 2.0, there appears to be a “list-index” property as well, which (I believe) can be used in the place of index.

Asides from being able to specify a base index value with “list-index”, is there a difference between the two? Any advantage to using one VS the other?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T15:58:01+00:00Added an answer on May 31, 2026 at 3:58 pm

    I had the same question and read the code. I found the following:

    (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);
        }
        // ...
    }
    

    Which means to me:

    • It is basically the same.
    • list-index overwrites index
    • The type of the index is set to int. So you had to check what actually happens when using another type in the mapping file.
    • list-index supports base to tell it on which index to start. (This is found somewhere else)
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using the field.camelcase in my mapping files to setting things like collections, dependant
How do I save a large collection with NHibernate which has elements that surpass
I have a class that contains a collection that is mapped to a many-to-many
I'm getting started with nHibernate code mapping and I'm stuck on mapping a collection
In nhibernate, I have two classes that are associated with a many-to-one mapping: <class
I'm trying to generate the correct mapping for 2 classes that have a collection
i have a collection in the mapping: <bag name=Values cascade=all-delete-orphan lazy=false inverse=true> <key column=[TemplateId]/>
I have in my mapping an association to an eagerly loaded collection (lazy=false fetch=subselect).
I'm running into significant difficulty getting my mapping file to work with a collection
I have a collection of objects to which I'd like to just add a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.