0

I have this mapping:

    public sealed class AcessoMap : ClassMap<Acesso>
{
    public AcessoMap()
    {
        CompositeId()
            .KeyReference(x => x.Associado)
            .KeyProperty(x => x.DataHora, k => k.ColumnName("aceDtHor").Type("Timestamp"));

        Map(x => x.IP, "aceEndIP");
        Map(x => x.NumeroAcesso).Not.Nullable().Generated.Insert();
        Map(x => x.DataAcessoAnterior).Not.Nullable().Generated.Insert();
        Map(x => x.ServerVariables).LazyLoad().Generated.Insert();
    }
}

How can I configure it to DataHora property use database generated value? (Current it have default value on db, that sets it to current timestamp)

Thank you

Zote
  • 5,343
  • 5
  • 41
  • 43

1 Answers1

0

I don't know if this will work, but it's something to try. Map your timestamp column regularly, outside the CompositeId definition.

Map(x=>x.RecordVersion).Column("aceDtHor")
                       .CustomSqlType( "timestamp" )
                       .Not.Nullable()
                       .CustomType( "BinaryBlob" )
                       .Generated.Always();
Steve Mallory
  • 4,245
  • 1
  • 28
  • 31
  • don't worked... I need to send null, this way my database will fill it with default value of column (that is "now()"). – Zote Apr 13 '12 at 14:22
  • @Zote well, the only other thing I can think of is to mark the timestamp as a Version field `Version(x=>x.aceDtHor) .... .UnsavedValue("null")..` and then use it as part of your key. – Steve Mallory Apr 13 '12 at 14:28