public new void Configure(ConfigurationElement configuration)
 {
     //Store the .config configuration section for us to maybe created modified version later (if requested on the model).
     //Note, we had to implement IConfigurable as well (despite it being implemented on our base class) or this would not be called.
     _realConfiguration  = configuration as OrderPipelinesProcessorConfiguration;
     base.Configure(configuration);
 }
コード例 #2
0
        public OrderPipelinesProcessorConfiguration Create(OrderPipelinesProcessorConfiguration configuration)
        {
            if (configuration == null) throw new ArgumentNullException("configuration");
            if(Pipelines == null) throw new InvalidOperationException("Pipelines is null.");
            if(Pipelines.Count == 0) throw new InvalidOperationException("Pipelines is an empty list.  You must specify at least one Pipeline to run.");

            var config = new XElement("OrderPipelines",
                                      Pipelines.Select(x =>
                                      {
                                          var xElement = new XElement("Pipeline");
                                          xElement.SetAttributeValue(XName.Get("name"), x.Name);
                                          xElement.SetAttributeValue(XName.Get("type"), x.Type);
                                          return (object) xElement;
                                      }).ToArray());

            return new RuntimeOrderPipelinesProcessorConfiguration(config);
        }
コード例 #3
0
        public OrderPipelinesProcessorConfiguration Create(OrderPipelinesProcessorConfiguration configuration)
        {
            if (configuration == null) throw new ArgumentNullException("configuration");

            var config = new XElement("OrderPipelines",
                                      configuration.OrderPipelines.Cast<PipelineConfigurationElement>()
                                                   .Select(pe =>
                                                   {
                                                       var xElement = new XElement("Pipeline");
                                                       var name = pe.PipelineName;
                                                       if (name.EndsWith(Suffix, StringComparison.InvariantCultureIgnoreCase))
                                                       {
                                                           name = name.Substring(0, name.Length - Suffix.Length);
                                                       }
                                                       xElement.SetAttributeValue(XName.Get("name"), name);
                                                       xElement.SetAttributeValue(XName.Get("type"), pe.PipelineType);
                                                       return (object) xElement;
                                                   }).ToArray()
                );

            return new RuntimeOrderPipelinesProcessorConfiguration(config);
        }