Paul Batum: Thanks for the answer. I have just implemented a listener, and it works fine, though I had hoped there was a more elegant solution (but I cant really think of how it could be possible). Thanks :)
Mikael Henriksson: www still not "working" - though it have changed since last time - in case the one responsible have forgot about it again. :) On 17 Feb., 11:21, Paul Batum <paul.ba...@gmail.com> wrote: > You should consider using event listeners to set your created at, any other > audit-style fields you have: > > http://ayende.com/Blog/archive/2009/04/29/nhibernate-ipreupdateeventl... > > On Mon, Feb 15, 2010 at 7:34 PM, Mikael Henriksson > <mik...@zoolutions.se>wrote: > > > > > James was working on moving FNH to a virtual private server I think... He > > probably got lost playing games and forgot about it :) > > > On Mon, Feb 15, 2010 at 3:35 AM, Martin From <f...@pc.dk> wrote: > > >> Hello, > > >> I have a base Entity type containing the properties - Id and CreatedAt > >> (Datetime). > >> In the required default parameterless constructor I always set > >> CreatedAt = DateTime.UtcNow; > > >> This works fine and acts like intended when creating new instances of > >> my entities for saving etc. > >> But when querying objects from the database the parameterless > >> constructor is also called and CreatedAt is set. > > >> CreatedAt is overwriten with the data fetched from the database but I > >> would like to not set it every time querying an object. > > >> How can I solve this ? > >> Is there some smart/clever/secret work around for this? > > >> The best i can come up with is to mark the parameterless constructor > >> as protected and not set the CreatedAt property, and then create a > >> public constructor with a parameter (that doesnt really matter) that > >> can be used when creating new instances of my objects which should be > >> saved, but it is a very ugly solution. > > >> Is there any problems in setting default values in the constructor for > >> properties which is mapped ? > > >> For an example I am wondering if it will be a problem if the CreatedAt > >> property is set to be lazyloaded and is never fetched from the > >> database before being saved (updated). > >> Will nhibernate internally know that the CreatedAt property was > >> assigned before the object data was fetched from the database and it > >> should not be used when updating? > > >> Best regards > > >> Martin > > >> ps.www.fluentnhibernate.orgjust gives me page saying "It works! This > >> is the default web page for this server. The web server software is > >> running but no content has been added, yet." in case project owners/ > >> administrator should look here and isnt aware of it. > > >> -- > >> You received this message because you are subscribed to the Google Groups > >> "Fluent NHibernate" group. > >> To post to this group, send email to fluent-nhibern...@googlegroups.com. > >> To unsubscribe from this group, send email to > >> fluent-nhibernate+unsubscr...@googlegroups.com<fluent-nhibernate%2bunsubscr...@googlegroups.com> > >> . > >> For more options, visit this group at > >>http://groups.google.com/group/fluent-nhibernate?hl=en. > > > -- > > You received this message because you are subscribed to the Google Groups > > "Fluent NHibernate" group. > > To post to this group, send email to fluent-nhibern...@googlegroups.com. > > To unsubscribe from this group, send email to > > fluent-nhibernate+unsubscr...@googlegroups.com<fluent-nhibernate%2bunsubscr...@googlegroups.com> > > . > > For more options, visit this group at > >http://groups.google.com/group/fluent-nhibernate?hl=en.- Skjul tekst i > >anførselstegn - > > - Vis tekst i anførselstegn - -- You received this message because you are subscribed to the Google Groups "Fluent NHibernate" group. To post to this group, send email to fluent-nhibern...@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.