created -> could be dealt with in the entity constructor. and existing
entity (i.e. read from DB) will have it wverwritten with the DB value

modified -> imo that's an applicative concern, and again should be dealt
with within the entity. otherwise you can look into implementing that with
the relevant EventListeners (that's an NHibernate thingie, but can be used
with ActiveRecord of course)



On Tue, Jan 6, 2009 at 4:20 PM, Mark Jensen <[email protected]> wrote:

>
> Hi
>
> I usually timestamp everything that I persist into the database with
> DateTime, I use two properties named Created and Modified.
>
> After going though various solutions I still haven't come up with
> something really I like.
>
> 1.
>
> override every Save,Update, Create method and add something like
>
> created = DateTime.Now; (should only be set when created)
> modified = DateTime.Now;
>
> 2.
>
> using the protected override bool BeforeSave(IDictionary state){}
>
> wich only seems to be called in some cases (haven't figures out what)
>
> 3.
>
> I have also looked at the Timestamp/Version attribute, but it doesn't
> seem to let me control when it should be used (eg. on save, update,
> create)
>
>
> Have I missed something? or do I really have to go with number 1,
> since that one seems to give me the most control.
>
> best regards,
> Mark
> >
>


-- 
Ken Egozi.
http://www.kenegozi.com/blog
http://www.delver.com
http://www.musicglue.com
http://www.castleproject.org
http://www.gotfriends.co.il

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to