Sean Gough
Sean Gough

Reputation: 1711

Fluent NHibernate — specify table/column names when using HiLo generator

Yes, nit-picky is a good way to describe this... ;)

Does anyone know if you can specify the table and/or column names to use HiLo using Fluent NHibernate? Currently the schema export creates this...

create table hibernate_unique_key (
     next_hi INTEGER 
)

Upvotes: 3

Views: 1669

Answers (1)

Sean Gough
Sean Gough

Reputation: 1711

Figured it out...

public class IdGenerationConvention : IIdConvention
{
    public void Apply(IIdentityInstance instance)
    {
        instance.GeneratedBy.HiLo("MyTableName", "NextHighValue", "1000");
    }
}

Upvotes: 4

Related Questions