Hi to all, I’m writing for share an idea related to simplify the integration of NHibernate and AOP cross-cutting concerns. The goal is simplify the adoption of AOP without using specific framework like PostSharp.
In particular the AOP functionalities should be exposed on entities mapped by NHibernate, with lazy loading support. In most of case adding additional behavior to existing object is provide by dependency injection container, that take care of construct a proxy over the object. If the interested object is mapped by NHibernate, the proxy should support lazy loading (collection and properties). I’ve found many frameworks that include example of NHibernate Bytecode provider; so in this case NHibernate can interact with container and resolving registered entities. From my research most of containers doesn’t fully support the features provided by NHibernate, in same case lazy loading isn’t support or lazy properties are not working. The consideration is related to allow NHibernate to expose interception capabilities in Bytecode provider in order to allow interception of following: NHibernate need to activate some instance of specific class type. In this case it’s possibile to check if container know this instance and resolve it injecting AOP specific behavior. After that container will return entity to NHibernate lifecycle. NHibernate perform creation of proxy object through ProxyFactory. In this case it’s possible to register class into container and resolve on next resolve call NHibernate need to activate proxy of registered instance for provide lazy loading. In this case it’s possibile to check if container contains this instance and resolve it injecting AOP specific behavior. In this case container return a proxy-of-proxy to NHibernate lifecycle. I think that this approach can simplify the integration with AOP, especially in first application development stage when performance in not key point. I’ve test this approach performing some modification to nhibenrate-core and seems to work. I’d kindly like to know your opinion about. Thank you Maurizio -- --- You received this message because you are subscribed to the Google Groups "nhibernate-development" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
