1- using System ;
2- using System . Collections . Generic ;
3- using Shuttle . Core . Container ;
4- using Shuttle . Core . Contract ;
1+ using Shuttle . Core . Contract ;
52using Shuttle . Core . Pipelines ;
6- using Shuttle . Core . PipelineTransaction ;
7- using Shuttle . Core . Reflection ;
8- using Shuttle . Core . Serialization ;
93using Shuttle . Core . Threading ;
10- using Shuttle . Core . Transactions ;
114
125namespace Shuttle . Recall
136{
@@ -53,83 +46,5 @@ public void Execute(IThreadState state)
5346
5447 _pipelineFactory . ReleasePipeline ( pipeline ) ;
5548 }
56-
57- public static void Register ( IComponentRegistry registry , IEventStoreConfiguration configuration )
58- {
59- Guard . AgainstNull ( registry , nameof ( registry ) ) ;
60- Guard . AgainstNull ( configuration , nameof ( configuration ) ) ;
61-
62- registry . AttemptRegisterInstance ( configuration ) ;
63-
64- registry . RegistryBoostrap ( ) ;
65-
66- registry . AttemptRegister < IEventMethodInvokerConfiguration , EventMethodInvokerConfiguration > ( ) ;
67- registry . AttemptRegister < IEventMethodInvoker , DefaultEventMethodInvoker > ( ) ;
68- registry . AttemptRegister < ISerializer , DefaultSerializer > ( ) ;
69- registry . AttemptRegister < IProjectionSequenceNumberTracker , ProjectionSequenceNumberTracker > ( ) ;
70- registry . AttemptRegister < IPrimitiveEventQueue , PrimitiveEventQueue > ( ) ;
71- registry . AttemptRegister < IConcurrenyExceptionSpecification , DefaultConcurrenyExceptionSpecification > ( ) ;
72-
73- registry . AttemptRegister < TransactionScopeObserver , TransactionScopeObserver > ( ) ;
74-
75- if ( ! registry . IsRegistered < ITransactionScopeFactory > ( ) )
76- {
77- var transactionScopeConfiguration =
78- configuration . TransactionScope ?? new TransactionScopeConfiguration ( ) ;
79-
80- registry . AttemptRegisterInstance < ITransactionScopeFactory > (
81- new DefaultTransactionScopeFactory ( transactionScopeConfiguration . Enabled ,
82- transactionScopeConfiguration . IsolationLevel ,
83- TimeSpan . FromSeconds ( transactionScopeConfiguration . TimeoutSeconds ) ) ) ;
84- }
85-
86- registry . AttemptRegister < IPipelineFactory , DefaultPipelineFactory > ( ) ;
87-
88- var reflectionService = new ReflectionService ( ) ;
89-
90- foreach ( var type in reflectionService . GetTypesAssignableTo < IPipeline > ( typeof ( EventProcessor ) . Assembly ) )
91- {
92- if ( type . IsInterface || type . IsAbstract || registry . IsRegistered ( type ) )
93- {
94- continue ;
95- }
96-
97- registry . Register ( type , type , Lifestyle . Transient ) ;
98- }
99-
100- var observers = new List < Type > ( ) ;
101-
102- foreach ( var type in reflectionService . GetTypesAssignableTo < IPipelineObserver > ( typeof ( EventProcessor ) . Assembly ) )
103- {
104- if ( type . IsInterface || type . IsAbstract )
105- {
106- continue ;
107- }
108-
109- var interfaceType = type . InterfaceMatching ( $ "I{ type . Name } ") ;
110-
111- if ( interfaceType != null )
112- {
113- if ( registry . IsRegistered ( type ) )
114- {
115- continue ;
116- }
117-
118- registry . Register ( interfaceType , type , Lifestyle . Singleton ) ;
119- }
120- else
121- {
122- throw new ApplicationException ( string . Format ( Resources . ObserverInterfaceMissingException , type . Name ) ) ;
123- }
124-
125- observers . Add ( type ) ;
126- }
127-
128- registry . RegisterCollection ( typeof ( IPipelineObserver ) , observers , Lifestyle . Singleton ) ;
129-
130- registry . AttemptRegister < IEventStore , EventStore > ( ) ;
131- registry . AttemptRegister < IEventProcessor , EventProcessor > ( ) ;
132- }
133-
13449 }
13550}
0 commit comments