public void CodeDomPipeline() { TestBehavior.count = 0; ICompilerConfiguration configuration = new CompilerConfiguration(); configuration.References().AddDirectory(Environment.CurrentDirectory); TestPipeline(behaviorProvider => new CodeDomPipeline <ProductQueryHandler>(new CodeDomPipelineConfiguration(behaviorProvider, configuration))); }
private static void TestServices() { Console.WriteLine("Current ThreadID: {0}", Thread.CurrentThread.ManagedThreadId); IBehaviorProvider behaviors = new BehaviorProviderCollection() .Add( new AttributeBehaviorCollection() .Add(typeof(ReprocessAttribute), typeof(ReprocessBehavior)) ); ICompilerConfiguration configuration = new CompilerConfiguration() //.BaseType(typeof(WorkerPipelineHandler<>)) .AddTempDirectory(@"C:\Temp\Pipelines"); configuration.References() .AddDirectory(Environment.CurrentDirectory); configuration.GetBehaviorGenerator( new CodeDomBehaviorGeneratorCollection() .Add(typeof(ReprocessAttribute), new CodeDomReprocessBehaviorInstanceGenerator()) ); ServiceHandlerCollection collection = new ServiceHandlerCollection(); //collection.Add(new TempCheckServiceHandler()); collection.Add( new BackgroundServiceCollection() .AddIntervalHandler(TimeSpan.FromSeconds(5), new TempCheckWorkerHandler()) ); //collection.Add(new Temp2CheckServiceHandler()); Console.WriteLine("Starting services..."); collection.Start(); Console.WriteLine("Press any key to stop services..."); Console.ReadKey(true); collection.Stop(); Console.WriteLine("All services stopped..."); }