Exemplo n.º 1
0
        /// <summary>
        ///     Builds and runs a property pipeline using a property schema, presets the property pipeline context to the the model
        ///     pipeline source.
        /// </summary>
        /// <param name="context">Model pipeline context</param>
        /// <param name="propertyPipelineSchema">Property pipeline context</param>
        private void RunPropertyPipeline(MappingContext context, PropertyPipelineSchema propertyPipelineSchema)
        {
            PropertyPipeline propertyPipeline = _propertyPipelineFactory.GetPropertyPipeline();

            foreach (ProcessorSchema propertyProcessorSchema in propertyPipelineSchema.Processors)
            {
                if (_processorFactory.TryGetProcessor(propertyProcessorSchema.Type, out IPropertyProcessor propertyProcesser))
                {
                    propertyPipeline.Add(propertyProcesser, propertyProcessorSchema);
                }
                else if (_processorFactory.TryGetProcessor(propertyProcessorSchema.Type, out IModelProcessor modelProcessor))
                {
                    propertyPipeline.Add(modelProcessor, propertyProcessorSchema);
                }
            }

            propertyPipeline.Run(new PropertyContext(context, propertyPipelineSchema.PropertyInfo, context.Input)
            {
                Monitor = context.Monitor
            });
        }