I'm exploring FluentNHibernate, and I love convention over configuration 
and automapping features, but i have a trouble when I want my identity 
property not to be in insert sql statement generated. I want primary key to 
be assigned by database.

For example:

instead of 

insert into Product(ProductId, Name) values (1, 'Test');

sql generated should be 

insert into Product(Name) values ('Test'); 

What I tried is adding convention like 

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

but that doesn't work. Should I use some other interface, or there is 
something else needed for this?


-- 
You received this message because you are subscribed to the Google Groups 
"Fluent NHibernate" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/fluent-nhibernate/-/gqUzYhlSX5QJ.
To post to this group, send email to fluent-nhibernate@googlegroups.com.
To unsubscribe from this group, send email to 
fluent-nhibernate+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/fluent-nhibernate?hl=en.

Reply via email to