I'm a bit surprised no one answered. Anyway, I just wanted to correct
myself, as I actually wanted to insert into a view, not a table. So,
conclusion on this is that FluentNHibernate generates correct xml
file, but NHibernate doesn't generate expected sql if an insert is
made on a view. And that is for both GeneratedBy.Native and
GeneratedBy.Identity.
On Mar 9, 7:24 pm, Sofija Blazevski <
sosin...@gmail.com> wrote:
> 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();*