Anule el valor inicial de incremento automático de la columna Id con Fluent nHibernate AutoMapping

I'm using Fluent nHibernate AutoMapping for a project and would like to change the initial Id value for one table in my schema from 1 to say 1000 (all other tables I would like to remain with the default behaviour of starting the Id at 1).

I'm guessing that I need to specify this in my IIDConvetion, but am not sure how?

public class PrimaryKeyConvention : IIdConvention
{
    public void Apply(IIdentityInstance instance)
    {
        instance.Column(instance.EntityType.Name + "Id");
        instance.GeneratedBy.Native();
    }
}

Would really appreciate being pointed in the right direction.

preguntado el 25 de agosto de 12 a las 12:08

1 Respuestas

AFAIK this is not supported yet. Your best bet is to implement IAuxiliaryDatabaseObject and set the starting value of the identity to 1000 with sql then add it as last element to the configuration object.

Respondido 28 ago 12, 09:08

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.