示例#1
0
        public IPipeline CreatePipeline(string assemblyOutputDirectory)
        {
            var remotionPipelineFactory = new RemotionPipelineFactory();
            var defaultPipeline         = SafeServiceLocator.Current.GetInstance <IPipelineRegistry>().DefaultPipeline;
            var participants            = defaultPipeline.Participants.ToArray();

            var participantTypeNames = participants.Select(p => p.GetType().Name).ToArray();

            s_log.InfoFormat(
                "Using pipeline '{0}' with the following participants: {1}.",
                defaultPipeline.ParticipantConfigurationID,
                string.Join(", ", participantTypeNames));
            Assertion.DebugAssert(participants.OfType <MixinParticipant>().Any(), "Mixin participant must be present.");

            var pipelineSettings = PipelineSettings.From(defaultPipeline.Settings)
                                   .SetAssemblyDirectory(assemblyOutputDirectory)
                                   .SetAssemblyNamePattern(_assemblyName)
                                   .SetDegreeOfParallelism(_degreeOfParallelism);

            var pipeline = remotionPipelineFactory.Create(
                defaultPipeline.ParticipantConfigurationID,
                pipelineSettings.Build(),
                participants);

            return(pipeline);
        }
        public void TypePipe()
        {
            var participants    = new IParticipant[] { new MixinParticipant(), new DomainObjectParticipant() };
            var pipelineFactory = new RemotionPipelineFactory();

            var pipeline             = pipelineFactory.Create("CachePerformanceTest", participants);
            var typeCache            = (ITypeCache)PrivateInvoke.GetNonPublicField(pipeline.ReflectionService, "_typeCache");
            var constructorCallCache = (IConstructorCallCache)PrivateInvoke.GetNonPublicField(pipeline.ReflectionService, "_constructorCallCache");
            var typeAssembler        = (ITypeAssembler)PrivateInvoke.GetNonPublicField(pipeline, "_typeAssembler");
            var typeID = typeAssembler.ComputeTypeID(typeof(DomainType));

            Func <Type>     typeCacheFunc = () => typeCache.GetOrCreateType(typeID);
            Func <Delegate> constructorDelegateCacheFunc = () => constructorCallCache.GetOrCreateConstructorCall(typeID, typeof(Func <object>), true);

            TimeThis("TypePipe_Types", typeCacheFunc);
            TimeThis("TypePipe_ConstructorDelegates", constructorDelegateCacheFunc);
        }
 public void SetUp()
 {
     _factory = new RemotionPipelineFactory();
 }