protected virtual void ConfigureConversation(IConversation conversation) { IConversationCreationInterceptor cci = null; Type creationInterceptorType = Metadata.Setting.ConversationCreationInterceptor; if (creationInterceptorType != null) { cci = creationInterceptorType.IsInterface ? GetConversationCreationInterceptor(creationInterceptorType) : creationInterceptorType.Instantiate <IConversationCreationInterceptor>(); } else { if (Metadata.Setting.UseConversationCreationInterceptorConvention) { Type concreteImplementationType = BaseConventionType.MakeGenericType(Metadata.ConversationalClass); cci = GetConversationCreationInterceptor(concreteImplementationType); } } if (cci != null) { cci.Configure(conversation); } if (Metadata.Setting.AllowOutsidePersistentCall) { var conversationWithOpc = conversation as ISupportOutsidePersistentCall; if (conversationWithOpc == null) { throw new InvalidOperationException("The conversation doesn't support outside persistent call"); } conversationWithOpc.UseSupportForOutsidePersistentCall = true; } }
private void ConfigureConversation(IConversation conversation, object instance) { IConversationCreationInterceptor cci = null; Type creationInterceptorType = ConversationCreationInterceptor; if (creationInterceptorType != null) { cci = creationInterceptorType.IsInterface ? GetConversationCreationInterceptor(creationInterceptorType) : creationInterceptorType.Instantiate <IConversationCreationInterceptor>(); } else { if (UseConversationCreationInterceptorConvention) { Type concreteImplementationType = BaseConventionType.MakeGenericType(instance.GetType()); cci = GetConversationCreationInterceptor(concreteImplementationType); } } if (cci != null) { cci.Configure(conversation); } if (AllowOutsidePersistentCall) { var conversationWithOpc = conversation as ISupportOutsidePersistentCall; if (conversationWithOpc == null) { throw new InvalidOperationException("The conversation doesn't support outside persistent call"); } conversationWithOpc.UseSupportForOutsidePersistentCall = true; } }