PDA

View Full Version : How to persist a proxy?


jwtulp
10-22-2006, 11:40 PM
Hi all,

as a newby of Spring Framework.Net and playing around with the AOP framework, I was wondering the following:

if I create an Introduction Advice where my Target is something that is persisted in a database and my mixin is also something that needs to be persisted, how do I do this properly?

For example, say I have a BlogPost class which is my Target, and my mixin contains functionality for rating any object, so not just BlogPosts, but also photos of a photogallery, usercomments, etc. etc. Of course my BlogPost objects need to be stored somewhere in a database, but the ratings for each BlogPost also need to be persisted somehow. But possibly also the ratings for my photo's, usercomments, etc. How do I do properly design this? Is there some way you can create a mapping in NHibernate for this? Has any of you ever dealt with something like this? How would you solve this? Or would you not use an Introduction Advice for this situation at all? If no, how would you solve this then?

Thanks!

Jan Willem Tulp