Well Fabio and i discussed some ideas…as always i only started thinking about how to implement them and he already had a complete solution for the things being discussed.
At least to feel I collaborate I will resume some of the things Fabio had been working on.
I added the new features to my sample project which was previously described here so i could play a little with tests. I also did it only looking at the code and svn log to feel how descriptive it was by itself.
Well, there are some things very new and some things that where missing an implementation...
First of all the MethodsIncludeMode property for the PersistenceConversational attribute is working, you can set it to Implicit or Explicit. Implicit will asume every public virtual method is part of a persistence conversation and will use the defaults if you don’t mark it as PersistenceConversation with your own properties. Explicit will consider only methods marked by you as part of the conversation.
Next we had a DefaultEndMode which was there but was not plugged in, now you can use it so every conversation will use as the default, if you want to do crazy things like set every method with EndMode.End, well, it is easy to do it even if not so right :)
Last but not least we can now set a ConversationConfigurationInterceptor either explicitly or injecting it using meantime the CastleAdapter. This means for example I can subscribe to every event of the conversation and explicitly do something if needed without doing a lot of work like i did in this post
The way to set an explicit Interceptor is having a class that inherits from IConversationCreationInterceptor which will have to implement the Configure method which receives a conversation, there you attach your events to the conversation and it is done. In the [PersistenceConversational] attribute you just set ConversationCreationInterceptor = typeof(MyInterceptor)
The DI way is creating a generic interceptor class that inherits from IConversationCreationInterceptorConvention<T> where T : class, the implementation is the same and it can be associated to a model implementing a generic class which receives a model and implements the interface. This will work if the property UseConversationCreationInterceptorConvention of PersistenceConversational is set to true (which is the default).
Well you can look at the code to see it working.