Hi Ken could you provide me with a link or an example on how to do what you describe with the modified-thingy ?
if I could do what you describe with the "create", wouldn't it then be possible to go with the Timestamp/Version attribute on the Modified property and then, maybe, rewrite it so it will use DateTime format instead? since a Timestamp is already activated when you save/update/ create, right? On Jan 6, 3:37 pm, "Ken Egozi" <[email protected]> wrote: > 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/bloghttp://www.delver.comhttp://www.musicglue.comhttp://www.castleproject.orghttp://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 -~----------~----~----~----~------~----~------~--~---
