I have a slough of domain entities (without interfaces) that largely
encapsulate various algorithms for calculation, returning a double
which needs to be rounded (or not).
I am using NHibernate so public methods/properties are marked virtual.

I now have a requirement where rounding is applied to many of the
methods according to a specific context. For example, when using the
entity for one agency, we'd apply specific rules or perhaps for a
certain report round according to a different set of rules.

The methods themselves are very focused in responsibility so the
entities are poised to do this fairly easily, and I think I can
leverage DynamicProxy to do something like:

double value = new Rounded().Instance(myInstance).MyCalculation();

Where 'Rounded' would generate a proxy and apply the appropriate
interceptor for rounding rules and return the proxy.

The only wall I have come up against is the inability to create
proxies of existing class instances. Like I mentioned I don't have
interfaces defined for the entities and before I go that route I
wanted to see if anyone has dealt with a similar issue for
contextualizing domain entities.

Any ideas on approaches that might engage castle voodoo?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
To post to this group, send email to castle-project-users@googlegroups.com
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