Example #1
0
        protected override ExportConfig CreateEntity()
        {
            _entity = new ExportConfig();
            XmlNodeList nodes = _validator.QuerySubNodes("//ExportProduct");

            foreach (XmlElement node in nodes)
            {
                ProductRuleElement ruleElement = new ProductRuleElement(node, this);
                _entity.ProductTypes.Add(ruleElement.Entity);
                _productRuleDict.Add(ruleElement.Entity.Name, ruleElement);
            }
            return(_entity);
        }
Example #2
0
        public ProductRule GetRules(string name, bool createNew = false)
        {
            if (_productRuleDict.ContainsKey(name))
            {
                ProductRuleElement ruleElement = _productRuleDict[name];

                /**
                 * 如果发现性能较差时,可考虑对ProductRule实现深度Clone,然后修改NewEntity的实现,
                 * 用临时变量存储创建的实体对象,每次从OriginalEntity属性中返回其Clone对象
                 */
                return(createNew ? ruleElement.NewEntity : ruleElement.Entity);
            }
            return(null);
        }
 public SourceElement(XmlElement data, ProductRuleElement productRuleElement)
 {
     this._data = data;
 }
 public DataListElement(XmlElement data, ProductRuleElement productRuleElement)
 {
     this._data = data;
 }
Example #5
0
 public SheetElement(XmlElement data, ProductRuleElement productRuleElement)
 {
     this._data = data;
     this._productRuleElement = productRuleElement;
 }