NHibernate HiLo generation and SQL 2005/8 Schemas

醉酒当歌 提交于 2019-12-06 07:17:59

I don't think there's anything wrong with solution B. Behavior will be pretty much the same.

Will Marcouiller

Only one such table per database should exist. Such data table should imply the following columns (let's call this table Parameters):

HiLoId
TableName
ParamName
HiLoAssigned

In addition to be used as a HiLo assignment data table, this could be used as a parameter table. As such, the ParamName field is required. This could contain data such as:

HiLoId | TableName | ParamName | HiLoAssigned
---------------------------------------------
   1   | Parameters| HiLoId    |       3
   2   | Customers | CustomerId|    9425 
   3   | Invoices  | InvoiceId |  134978

And when you need some other parameters, such as a parameter for a job that would prune your tables for history, then an age parameter for record could be inserted into it.

Well, I'm a little further in the subject than what you actually asked. Just sharing some additional thoughts in database design/architecture.

Take an eye out this question, and see my answer there. This might answer your question as well, and bring further information to this answer.

Have you tried specifying the schema with the table name on all generators (including the ones already in the dbo schema? I.e.

<param name="table">dbo.hibernate_unique_key</param>

The hilo generator looks for a '.' in the table name, and qualifies it (with schema) only if one isn't there.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!