What are all the NHibernate HiLo generator params?

2019-04-07 10:43发布

问题:

I've seen some docs by Fabio Maulo that shows the following params:

<id name="Id" type="Int64" column="cat_id">
    <generator class="hilo">
            <param name="table">hi_value</param>
            <param name="column">next_value</param>
            <param name="max_lo">100</param>
    </generator>
</id>

However, on this question the poster uses a <param name="schema">... I'd like to be able to specify schema for the HiLo generator.

Is there definitive documentation for all generator parameters? I've tried googling it without success.

回答1:

Another param to throw in the mix is

<param name="where">TableName='CmsLogin'</param>

This gives you the ability to have different counters per entity rather than a counter for all entities.

However I have not seen a way to specify the schema as a param so I think you need to go with creating a separate HiLo Key table for each unique schema in the database.



回答2:

According to the source, the full list is: "table", "column", "max_lo", "schema", "catalog" and "where", but I don't know if they are all being used. These are defined in classes NHibernate.Id.TableGenerator and NHibernate.Id.TableHiLoGenerator .