NHibernate HiLo - one table for all entities

后端 未结 3 1726
醉梦人生
醉梦人生 2021-02-04 17:03

I\'m using NHibernate HiLo as my identity generator. I currently have a sepperate table in my database for each of my entity tables. For example I have Customer and CustomerKey

相关标签:
3条回答
  • 2021-02-04 17:11

    I have written about this here: http://daniel.wertheim.se/2011/03/08/nhibernate-custom-id-generator/

    0 讨论(0)
  • 2021-02-04 17:33

    there is a patch for adding this on JIRA, but I don't know when it will be in the trunk https://nhibernate.jira.com/browse/NH-1374

    0 讨论(0)
  • 2021-02-04 17:37

    Have you tried using the where property of the hilo generator? Something like:

    <class name="Customer">
        <id name="Id">
            <generator class="hilo">
                <param name="where">TableName = 'Customer'</param>
                ...
            </generator>
        </id>
        ...
    </class>
    
    0 讨论(0)
提交回复
热议问题