FluentNHibernate - Setting default value for DB columns (SQL Server)

Posted by Nikola Malovic on Stack Overflow See other posts from Stack Overflow or by Nikola Malovic
Published on 2009-10-15T11:28:33Z Indexed on 2010/04/09 12:43 UTC
Read the original article Hit count: 420

Hi everyone,

does anyone know a way how I could set through mapping the default value of a column so for e.g. when I generate DB from mappings I would have DateTime column having getdate() as default value?

I tried so far this (looks exactlly like what I need) but it doesn't work

this.Map(x => x.LastPersistedOn, "DateModified") 
    .Access.Property() 
    .Default("getdate()");

© Stack Overflow or respective owner

Related posts about fluent-nhibernate

Related posts about sql-server