public void IsNotEqual_IsNotEqualUnitTest_Invoke_TrueIsReturned()
        {
            var comparer = new IsNotEqual();
            var actual   = comparer.Invoke(new[] { "100", "100" });

            Assert.IsFalse(actual, "IsNotEqual returned the wrong result when comparing integers");
        }
        public void IsNotEqual_IsNotEqualUnitTest_HandleType_ShouldReturnIsNotEqual()
        {
            var decisionType = enDecisionType.IsNotEqual;
            //------------Setup for test--------------------------
            var isNotEqual = new IsNotEqual();

            //------------Execute Test---------------------------
            //------------Assert Results-------------------------
            Assert.AreEqual(decisionType, isNotEqual.HandlesType());
        }
Exemplo n.º 3
0
        public void IsEndsWith_HandlesType_ReturnsIsEndsWithType()
        {
            var expected = enDecisionType.IsNotEqual;
            //------------Setup for test--------------------------
            var isEndsWith = new IsNotEqual();

            //------------Execute Test---------------------------
            //------------Assert Results-------------------------
            Assert.AreEqual(expected, isEndsWith.HandlesType());
        }
Exemplo n.º 4
0
        /// <summary>
        /// Deserializes the specified configuration in an <see cref="IsNotEqual"/> object
        /// </summary>
        /// <param name="configuration">The configuration.</param>
        /// <returns></returns>
        public override SqlTag Deserialize(IConfiguration configuration)
        {
            IsNotEqual isNotEqual = new IsNotEqual(accessorFactory);

            isNotEqual.Prepend         = ConfigurationUtils.GetStringAttribute(configuration.Attributes, "prepend");
            isNotEqual.Property        = ConfigurationUtils.GetStringAttribute(configuration.Attributes, "property");
            isNotEqual.CompareProperty = ConfigurationUtils.GetStringAttribute(configuration.Attributes, "compareProperty");
            isNotEqual.CompareValue    = ConfigurationUtils.GetStringAttribute(configuration.Attributes, "compareValue");

            return(isNotEqual);
        }
        public void IsNotEqual_IsNotEqualUnitTest_Invoke_TrueIsReturned_Decimal()
        // ReSharper restore InconsistentNaming
        {
            var comparer = new IsNotEqual();
            var actual   = comparer.Invoke(new[] { "1.08", "1.80" });

            Assert.IsTrue(actual, "IsNotEqual returned the wrong result when comparing integers");

            actual = comparer.Invoke(new[] { "Val", "Val" });
            Assert.IsFalse(actual, "IsNotEqual returned the wrong result when comparing strings");
        }
Exemplo n.º 6
0
        public SqlTag Deserialize(XmlNode node)
        {
            IsNotEqual          equal      = new IsNotEqual(this._configScope.DataExchangeFactory.AccessorFactory);
            NameValueCollection attributes = NodeUtils.ParseAttributes(node, this._configScope.Properties);

            equal.Prepend         = NodeUtils.GetStringAttribute(attributes, "prepend");
            equal.Property        = NodeUtils.GetStringAttribute(attributes, "property");
            equal.CompareProperty = NodeUtils.GetStringAttribute(attributes, "compareProperty");
            equal.CompareValue    = NodeUtils.GetStringAttribute(attributes, "compareValue");
            return(equal);
        }
Exemplo n.º 7
0
        public void IsEndsWith_Invoke_NotEqualItems_ReturnsFalse()
        {
            //------------Setup for test--------------------------
            var endsWith = new IsNotEqual();
            var cols     = new string[2];

            cols[0] = "TestData";
            cols[1] = "No";
            //------------Execute Test---------------------------
            var result = endsWith.Invoke(cols);

            //------------Assert Results-------------------------
            Assert.IsTrue(result);
        }
Exemplo n.º 8
0
        public void IsEqual_Invoke_ItemsEqual_ReturnsTrue()
        {
            //------------Setup for test--------------------------
            var endsWith = new IsNotEqual();

            string[] cols = new string[2];
            cols[0] = "TestData";
            cols[1] = "TestData";
            //------------Execute Test---------------------------
            bool result = endsWith.Invoke(cols);

            //------------Assert Results-------------------------
            Assert.IsFalse(result);
        }
Exemplo n.º 9
0
        /// <summary>
        /// Deserialize a Dynamic object
        /// </summary>
        /// <param name="node"></param>
        /// <returns></returns>
        public SqlTag Deserialize(XmlNode node)
        {
            var isNotEqual = new IsNotEqual(_configScope.DataExchangeFactory.AccessorFactory);

            NameValueCollection prop = NodeUtils.ParseAttributes(node, _configScope.Properties);

            isNotEqual.Prepend         = NodeUtils.GetStringAttribute(prop, "prepend");
            isNotEqual.Literal         = NodeUtils.GetStringAttribute(prop, "literal");
            isNotEqual.Property        = NodeUtils.GetStringAttribute(prop, "property");
            isNotEqual.CompareProperty = NodeUtils.GetStringAttribute(prop, "compareProperty");
            isNotEqual.CompareValue    = NodeUtils.GetStringAttribute(prop, "compareValue");

            return(isNotEqual);
        }
Exemplo n.º 10
0
        public static ITag LoadTag(XmlNode xmlNode, IList <Include> includes)
        {
            ITag tag          = null;
            bool isIn         = xmlNode.Attributes?["In"] != null;
            var  prepend      = xmlNode.Attributes?["Prepend"]?.Value.Trim();
            var  property     = xmlNode.Attributes?["Property"]?.Value.Trim();
            var  compareValue = xmlNode.Attributes?["CompareValue"]?.Value.Trim();

            #region Init Tag
            switch (xmlNode.Name)
            {
            case "#text":
            case "#cdata-section":
            {
                var bodyText = " " + xmlNode.InnerText.Replace("\n", "").Trim();
                return(new SqlText
                    {
                        BodyText = bodyText
                    });
            }

            case "Include":
            {
                var refId       = xmlNode.Attributes?["RefId"]?.Value;
                var include_tag = new Include
                {
                    RefId   = refId,
                    Prepend = prepend
                };
                includes.Add(include_tag);
                tag = include_tag;
                break;
            }

            case "IsEmpty":
            {
                tag = new IsEmpty
                {
                    In        = isIn,
                    Prepend   = prepend,
                    Property  = property,
                    ChildTags = new List <ITag>()
                };
                break;
            }

            case "IsEqual":
            {
                tag = new IsEqual
                {
                    In           = isIn,
                    Prepend      = prepend,
                    Property     = property,
                    CompareValue = compareValue,
                    ChildTags    = new List <ITag>()
                };
                break;
            }

            case "IsGreaterEqual":
            {
                tag = new IsGreaterEqual
                {
                    In           = isIn,
                    Prepend      = prepend,
                    Property     = property,
                    CompareValue = compareValue,
                    ChildTags    = new List <ITag>()
                };
                break;
            }

            case "IsGreaterThan":
            {
                tag = new IsGreaterThan
                {
                    In           = isIn,
                    Prepend      = prepend,
                    Property     = property,
                    CompareValue = compareValue,
                    ChildTags    = new List <ITag>()
                };
                break;
            }

            case "IsLessEqual":
            {
                tag = new IsLessEqual
                {
                    In           = isIn,
                    Prepend      = prepend,
                    Property     = property,
                    CompareValue = compareValue,
                    ChildTags    = new List <ITag>()
                };
                break;
            }

            case "IsLessThan":
            {
                tag = new IsLessThan
                {
                    In           = isIn,
                    Prepend      = prepend,
                    Property     = property,
                    CompareValue = compareValue,
                    ChildTags    = new List <ITag>()
                };
                break;
            }

            case "IsNotEmpty":
            {
                tag = new IsNotEmpty
                {
                    In        = isIn,
                    Prepend   = prepend,
                    Property  = property,
                    ChildTags = new List <ITag>()
                };
                break;
            }

            case "IsNotEqual":
            {
                tag = new IsNotEqual
                {
                    In           = isIn,
                    Prepend      = prepend,
                    Property     = property,
                    CompareValue = compareValue,
                    ChildTags    = new List <ITag>()
                };
                break;
            }

            case "IsNotNull":
            {
                tag = new IsNotNull
                {
                    In        = isIn,
                    Prepend   = prepend,
                    Property  = property,
                    ChildTags = new List <ITag>()
                };
                break;
            }

            case "IsNull":
            {
                tag = new IsNull
                {
                    In        = isIn,
                    Prepend   = prepend,
                    Property  = property,
                    ChildTags = new List <ITag>()
                };
                break;
            }

            case "IsTrue":
            {
                tag = new IsTrue
                {
                    In        = isIn,
                    Prepend   = prepend,
                    Property  = property,
                    ChildTags = new List <ITag>()
                };
                break;
            }

            case "IsFalse":
            {
                tag = new IsFalse
                {
                    In        = isIn,
                    Prepend   = prepend,
                    Property  = property,
                    ChildTags = new List <ITag>()
                };
                break;
            }

            case "IsProperty":
            {
                tag = new IsProperty
                {
                    In        = isIn,
                    Prepend   = prepend,
                    Property  = property,
                    ChildTags = new List <ITag>()
                };
                break;
            }

            case "Switch":
            {
                tag = new Switch
                {
                    Property = property,
                    //Prepend = prepend,
                    ChildTags = new List <ITag>()
                };
                break;
            }

            case "Case":
            {
                var switchNode     = xmlNode.ParentNode;
                var switchProperty = switchNode.Attributes?["Property"]?.Value.Trim();
                var switchPrepend  = switchNode.Attributes?["Prepend"]?.Value.Trim();
                tag = new Switch.Case
                {
                    CompareValue = compareValue,
                    Property     = switchProperty,
                    Prepend      = switchPrepend,
                    ChildTags    = new List <ITag>()
                };
                break;
            }

            case "Default":
            {
                var switchNode     = xmlNode.ParentNode;
                var switchProperty = switchNode.Attributes?["Property"]?.Value.Trim();
                var switchPrepend  = switchNode.Attributes?["Prepend"]?.Value.Trim();
                tag = new Switch.Defalut
                {
                    Property  = switchProperty,
                    Prepend   = switchPrepend,
                    ChildTags = new List <ITag>()
                };
                break;
            }

            case "Dynamic":
            {
                tag = new Dynamic
                {
                    Prepend   = prepend,
                    ChildTags = new List <ITag>()
                };
                break;
            }

            case "Where":
            {
                tag = new Where
                {
                    ChildTags = new List <ITag>()
                };
                break;
            }

            case "Set":
            {
                tag = new Set
                {
                    ChildTags = new List <ITag>()
                };
                break;
            }

            case "For":
            {
                var open      = xmlNode.Attributes?["Open"]?.Value.Trim();
                var separator = xmlNode.Attributes?["Separator"]?.Value.Trim();
                var close     = xmlNode.Attributes?["Close"]?.Value.Trim();
                var key       = xmlNode.Attributes?["Key"]?.Value.Trim();
                tag = new For
                {
                    Prepend   = prepend,
                    Property  = property,
                    Open      = open,
                    Close     = close,
                    Separator = separator,
                    Key       = key,
                    ChildTags = new List <ITag>()
                };
                break;
            }

            case "Env":
            {
                var dbProvider = xmlNode.Attributes?["DbProvider"]?.Value.Trim();
                tag = new Env
                {
                    Prepend    = prepend,
                    DbProvider = dbProvider,
                    ChildTags  = new List <ITag>()
                };
                break;
            }

            case "#comment": { break; }

            default:
            {
                throw new SmartSqlException($"Statement.LoadTag unkonw tagName:{xmlNode.Name}.");
            };
            }
            #endregion
            foreach (XmlNode childNode in xmlNode)
            {
                ITag childTag = LoadTag(childNode, includes);
                if (childTag != null && tag != null)
                {
                    (tag as Tag).ChildTags.Add(childTag);
                }
            }
            return(tag);
        }
Exemplo n.º 11
0
        private ITag LoadTag(XmlNode xmlNode, Statement statement)
        {
            ITag tag          = null;
            var  prepend      = xmlNode.Attributes?["Prepend"]?.Value.Trim();
            var  property     = xmlNode.Attributes?["Property"]?.Value.Trim();
            var  compareValue = xmlNode.Attributes?["CompareValue"]?.Value.Trim();

            #region Init Tag
            switch (xmlNode.Name)
            {
            case "#text":
            case "#cdata-section":
            {
                var innerText = xmlNode.InnerText;
                var bodyText  = innerText;
                //bodyText += innerText.Trim().Replace("\r", " ").Replace("\n", " ");
                //bodyText += " ";
                return(new SqlText
                    {
                        Statement = statement,
                        BodyText = bodyText
                    });
            }

            case "Include":
            {
                var refId = xmlNode.Attributes?["RefId"]?.Value;
                if (refId.IndexOf('.') < 0)
                {
                    refId = $"{statement.SmartSqlMap.Scope}.{refId}";
                }
                var include_tag = new Include
                {
                    RefId   = refId,
                    Prepend = xmlNode.Attributes?["Prepend"]?.Value
                };
                statement.IncludeDependencies.Add(include_tag);
                tag = include_tag;
                break;
            }

            case "IsEmpty":
            {
                tag = new IsEmpty
                {
                    Prepend   = prepend,
                    Property  = property,
                    ChildTags = new List <ITag>()
                };
                break;
            }

            case "IsEqual":
            {
                tag = new IsEqual
                {
                    Prepend      = prepend,
                    Property     = property,
                    CompareValue = compareValue,
                    ChildTags    = new List <ITag>()
                };
                break;
            }

            case "IsGreaterEqual":
            {
                tag = new IsGreaterEqual
                {
                    Prepend      = prepend,
                    Property     = property,
                    CompareValue = compareValue,
                    ChildTags    = new List <ITag>()
                };
                break;
            }

            case "IsGreaterThan":
            {
                tag = new IsGreaterThan
                {
                    Prepend      = prepend,
                    Property     = property,
                    CompareValue = compareValue,
                    ChildTags    = new List <ITag>()
                };
                break;
            }

            case "IsLessEqual":
            {
                tag = new IsLessEqual
                {
                    Prepend      = prepend,
                    Property     = property,
                    CompareValue = compareValue,
                    ChildTags    = new List <ITag>()
                };
                break;
            }

            case "IsLessThan":
            {
                tag = new IsLessThan
                {
                    Prepend      = prepend,
                    Property     = property,
                    CompareValue = compareValue,
                    ChildTags    = new List <ITag>()
                };
                break;
            }

            case "IsNotEmpty":
            {
                tag = new IsNotEmpty
                {
                    Prepend   = prepend,
                    Property  = property,
                    ChildTags = new List <ITag>()
                };
                break;
            }

            case "IsNotEqual":
            {
                tag = new IsNotEqual
                {
                    Prepend      = prepend,
                    Property     = property,
                    CompareValue = compareValue,
                    ChildTags    = new List <ITag>()
                };
                break;
            }

            case "IsNotNull":
            {
                tag = new IsNotNull
                {
                    Prepend   = prepend,
                    Property  = property,
                    ChildTags = new List <ITag>()
                };
                break;
            }

            case "IsNull":
            {
                tag = new IsNull
                {
                    Prepend   = prepend,
                    Property  = property,
                    ChildTags = new List <ITag>()
                };
                break;
            }

            case "IsTrue":
            {
                tag = new IsTrue
                {
                    Prepend   = prepend,
                    Property  = property,
                    ChildTags = new List <ITag>()
                };
                break;
            }

            case "IsFalse":
            {
                tag = new IsFalse
                {
                    Prepend   = prepend,
                    Property  = property,
                    ChildTags = new List <ITag>()
                };
                break;
            }

            case "IsProperty":
            {
                tag = new IsProperty
                {
                    Prepend   = prepend,
                    Property  = property,
                    ChildTags = new List <ITag>()
                };
                break;
            }

            case "Placeholder":
            {
                tag = new Placeholder
                {
                    Prepend   = xmlNode.Attributes?["Prepend"]?.Value,
                    Property  = property,
                    ChildTags = new List <ITag>()
                };
                break;
            }

            case "Switch":
            {
                tag = new Switch
                {
                    Property  = property,
                    Prepend   = prepend,
                    ChildTags = new List <ITag>()
                };
                break;
            }

            case "Case":
            {
                var switchNode     = xmlNode.ParentNode;
                var switchProperty = switchNode.Attributes?["Property"]?.Value.Trim();
                var switchPrepend  = switchNode.Attributes?["Prepend"]?.Value.Trim();
                tag = new Switch.Case
                {
                    CompareValue = compareValue,
                    Property     = switchProperty,
                    Prepend      = switchPrepend,
                    ChildTags    = new List <ITag>()
                };
                break;
            }

            case "Default":
            {
                var switchNode     = xmlNode.ParentNode;
                var switchProperty = switchNode.Attributes?["Property"]?.Value.Trim();
                var switchPrepend  = switchNode.Attributes?["Prepend"]?.Value.Trim();
                tag = new Switch.Defalut
                {
                    Property  = switchProperty,
                    Prepend   = switchPrepend,
                    ChildTags = new List <ITag>()
                };
                break;
            }

            case "Dynamic":
            {
                tag = new Dynamic
                {
                    Prepend   = prepend,
                    ChildTags = new List <ITag>()
                };
                break;
            }

            case "Where":
            {
                tag = new Where
                {
                    ChildTags = new List <ITag>()
                };
                break;
            }

            case "Set":
            {
                tag = new Set
                {
                    ChildTags = new List <ITag>()
                };
                break;
            }

            case "For":
            {
                var open      = xmlNode.Attributes?["Open"]?.Value.Trim();
                var separator = xmlNode.Attributes?["Separator"]?.Value.Trim();
                var close     = xmlNode.Attributes?["Close"]?.Value.Trim();
                var key       = xmlNode.Attributes?["Key"]?.Value.Trim();
                tag = new For
                {
                    Prepend   = prepend,
                    Property  = property,
                    Open      = open,
                    Close     = close,
                    Separator = separator,
                    Key       = key,
                    ChildTags = new List <ITag>()
                };
                break;
            }

            case "Env":
            {
                var dbProvider = xmlNode.Attributes?["DbProvider"]?.Value.Trim();
                tag = new Env
                {
                    Prepend    = prepend,
                    DbProvider = dbProvider,
                    ChildTags  = new List <ITag>()
                };
                break;
            }

            case "#comment": { return(null); }

            default:
            {
                throw new SmartSqlException($"Statement.LoadTag unkonw tagName:{xmlNode.Name}.");
            };
            }
            tag.Statement = statement;
            #endregion
            foreach (XmlNode childNode in xmlNode)
            {
                ITag childTag = LoadTag(childNode, statement);
                if (childTag != null && tag != null)
                {
                    childTag.Parent = tag;
                    (tag as Tag).ChildTags.Add(childTag);
                }
            }
            return(tag);
        }
Exemplo n.º 12
0
        public static ITag LoadTag(XmlNode xmlNode)
        {
            ITag tag          = null;
            bool isIn         = xmlNode.Attributes?["In"] != null;
            var  prepend      = xmlNode.Attributes?["Prepend"]?.Value;
            var  property     = xmlNode.Attributes?["Property"]?.Value;
            var  compareValue = xmlNode.Attributes?["CompareValue"]?.Value;

            #region Init Tag
            switch (xmlNode.Name)
            {
            case "#text":
            case "#cdata-section":
            {
                var bodyText = xmlNode.InnerText.Replace("\n", "");
                return(new SqlText
                    {
                        BodyText = bodyText
                    });
            }

            case "IsEmpty":
            {
                tag = new IsEmpty
                {
                    In        = isIn,
                    Prepend   = prepend,
                    Property  = property,
                    ChildTags = new List <ITag>()
                };
                break;
            }

            case "IsEqual":
            {
                tag = new IsEqual
                {
                    In           = isIn,
                    Prepend      = prepend,
                    Property     = property,
                    CompareValue = compareValue,
                    ChildTags    = new List <ITag>()
                };
                break;
            }

            case "IsGreaterEqual":
            {
                tag = new IsGreaterEqual
                {
                    In           = isIn,
                    Prepend      = prepend,
                    Property     = property,
                    CompareValue = compareValue,
                };
                break;
            }

            case "IsGreaterThan":
            {
                tag = new IsGreaterThan
                {
                    In           = isIn,
                    Prepend      = prepend,
                    Property     = property,
                    CompareValue = compareValue,
                    ChildTags    = new List <ITag>()
                };
                break;
            }

            case "IsLessEqual":
            {
                tag = new IsLessEqual
                {
                    In           = isIn,
                    Prepend      = prepend,
                    Property     = property,
                    CompareValue = compareValue,
                    ChildTags    = new List <ITag>()
                };
                break;
            }

            case "IsLessThan":
            {
                tag = new IsLessThan
                {
                    In           = isIn,
                    Prepend      = prepend,
                    Property     = property,
                    CompareValue = compareValue,
                    ChildTags    = new List <ITag>()
                };
                break;
            }

            case "IsNotEmpty":
            {
                tag = new IsNotEmpty
                {
                    In        = isIn,
                    Prepend   = prepend,
                    Property  = property,
                    ChildTags = new List <ITag>()
                };
                break;
            }

            case "IsNotEqual":
            {
                tag = new IsNotEqual
                {
                    In           = isIn,
                    Prepend      = prepend,
                    Property     = property,
                    CompareValue = compareValue,
                    ChildTags    = new List <ITag>()
                };
                break;
            }

            case "IsNotNull":
            {
                tag = new IsNotNull
                {
                    In        = isIn,
                    Prepend   = prepend,
                    Property  = property,
                    ChildTags = new List <ITag>()
                };
                break;
            }

            case "IsNull":
            {
                tag = new IsNull
                {
                    In        = isIn,
                    Prepend   = prepend,
                    Property  = property,
                    ChildTags = new List <ITag>()
                };
                break;
            }

            case "IsTrue":
            {
                tag = new IsTrue
                {
                    In        = isIn,
                    Prepend   = prepend,
                    Property  = property,
                    ChildTags = new List <ITag>()
                };
                break;
            }

            case "IsFalse":
            {
                tag = new IsFalse
                {
                    In        = isIn,
                    Prepend   = prepend,
                    Property  = property,
                    ChildTags = new List <ITag>()
                };
                break;
            }

            case "Switch":
            {
                tag = new Switch
                {
                    Property = property,
                    //Prepend = prepend,
                    ChildTags = new List <ITag>()
                };
                break;
            }

            case "Case":
            {
                var switchNode     = xmlNode.ParentNode;
                var switchProperty = switchNode.Attributes?["Property"]?.Value;
                var switchPrepend  = switchNode.Attributes?["Prepend"]?.Value;
                tag = new Switch.Case
                {
                    CompareValue = compareValue,
                    Property     = switchProperty,
                    Prepend      = switchPrepend,
                    ChildTags    = new List <ITag>()
                };
                break;
            }

            case "#comment": { break; }

            default: { break; };
            }
            #endregion
            foreach (XmlNode childNode in xmlNode)
            {
                ITag childTag = LoadTag(childNode);
                (tag as Tag).ChildTags.Add(childTag);
            }
            return(tag);
        }
Exemplo n.º 13
0
        private ITag LoadTag(XNode xmlNode, IList <Include> includes)
        {
            ITag tag          = null;
            var  prepend      = xmlNode?.GetAttribute("Prepend")?.Trim();
            var  property     = xmlNode?.GetAttribute("Property")?.Trim();
            var  compareValue = xmlNode?.GetAttribute("CompareValue")?.Trim();

            #region Init Tag
            switch (xmlNode.GetName())
            {
            case "#text":
            case "#cdata-section":
            {
                var bodyText = " " + xmlNode.GetValue().Replace("\n", "").Trim();
                return(new SqlText
                    {
                        LineInfo = XmlLineInfo.Create(xmlNode),
                        BodyText = bodyText
                    });
            }

            case "If":
            {
                tag = new IfTag
                {
                    Test = xmlNode.GetAttribute("Test")
                };
                break;
            }

            case "Include":
            {
                var refId       = xmlNode?.GetAttribute("RefId");
                var include_tag = new Include
                {
                    RefId   = refId,
                    Prepend = prepend
                };
                includes.Add(include_tag);
                tag = include_tag;
                break;
            }

            case "IsEmpty":
            {
                tag = new IsEmpty
                {
                    Prepend   = prepend,
                    Property  = property,
                    ChildTags = new List <ITag>()
                };
                break;
            }

            case "IsEqual":
            {
                tag = new IsEqual
                {
                    Prepend      = prepend,
                    Property     = property,
                    CompareValue = compareValue,
                    ChildTags    = new List <ITag>()
                };
                break;
            }

            case "Bind":
            {
                tag = new BindTag
                {
                    Name  = xmlNode.GetAttribute("Name"),
                    Value = xmlNode.GetAttribute("Value"),
                };
                break;
            }

            case "Trim":
            {
                tag = new TrimTag
                {
                    Prefix          = xmlNode.GetAttribute("Prefix"),
                    PrefixOverrides = xmlNode.GetAttribute("PrefixOverrides"),
                    Suffix          = xmlNode.GetAttribute("Suffix"),
                    ChildTags       = new List <ITag>(),
                };
                break;
            }

            case "IsGreaterEqual":
            {
                tag = new IsGreaterEqual
                {
                    Prepend      = prepend,
                    Property     = property,
                    CompareValue = compareValue,
                    ChildTags    = new List <ITag>()
                };
                break;
            }

            case "IsGreaterThan":
            {
                tag = new IsGreaterThan
                {
                    Prepend      = prepend,
                    Property     = property,
                    CompareValue = compareValue,
                    ChildTags    = new List <ITag>()
                };
                break;
            }

            case "IsLessEqual":
            {
                tag = new IsLessEqual
                {
                    Prepend      = prepend,
                    Property     = property,
                    CompareValue = compareValue,
                    ChildTags    = new List <ITag>()
                };
                break;
            }

            case "IsLessThan":
            {
                tag = new IsLessThan
                {
                    Prepend      = prepend,
                    Property     = property,
                    CompareValue = compareValue,
                    ChildTags    = new List <ITag>()
                };
                break;
            }

            case "IsNotEmpty":
            {
                tag = new IsNotEmpty
                {
                    Prepend   = prepend,
                    Property  = property,
                    ChildTags = new List <ITag>()
                };
                break;
            }

            case "IsNotEqual":
            {
                tag = new IsNotEqual
                {
                    Prepend      = prepend,
                    Property     = property,
                    CompareValue = compareValue,
                    ChildTags    = new List <ITag>()
                };
                break;
            }

            case "IsNotNull":
            {
                tag = new IsNotNull
                {
                    Prepend   = prepend,
                    Property  = property,
                    ChildTags = new List <ITag>()
                };
                break;
            }

            case "IsNull":
            {
                tag = new IsNull
                {
                    Prepend   = prepend,
                    Property  = property,
                    ChildTags = new List <ITag>()
                };
                break;
            }

            case "IsTrue":
            {
                tag = new IsTrue
                {
                    Prepend   = prepend,
                    Property  = property,
                    ChildTags = new List <ITag>()
                };
                break;
            }

            case "IsFalse":
            {
                tag = new IsFalse
                {
                    Prepend   = prepend,
                    Property  = property,
                    ChildTags = new List <ITag>()
                };
                break;
            }

            case "IsProperty":
            {
                tag = new IsProperty
                {
                    Prepend   = prepend,
                    Property  = property,
                    ChildTags = new List <ITag>()
                };
                break;
            }

            case "Placeholder":
            {
                tag = new Placeholder
                {
                    Prepend   = prepend,
                    Property  = property,
                    ChildTags = new List <ITag>()
                };
                break;
            }

            case "Switch":
            {
                tag = new Switch
                {
                    Property  = property,
                    Prepend   = prepend,
                    ChildTags = new List <ITag>()
                };
                break;
            }

            case "Case":
            {
                var switchNode     = xmlNode.Parent;
                var switchProperty = xmlNode?.GetAttribute("Property")?.Trim();
                var switchPrepend  = xmlNode?.GetAttribute("Prepend")?.Trim();
                tag = new Switch.Case
                {
                    CompareValue = compareValue,
                    Property     = switchProperty,
                    Prepend      = switchPrepend,
                    Test         = xmlNode?.GetAttribute("Test")?.Trim(),
                    ChildTags    = new List <ITag>()
                };
                break;
            }

            case "Default":
            {
                var switchNode     = xmlNode.Parent;
                var switchProperty = xmlNode?.GetAttribute("Property")?.Trim();
                var switchPrepend  = xmlNode?.GetAttribute("Prepend")?.Trim();
                tag = new Switch.Defalut
                {
                    Property  = switchProperty,
                    Prepend   = switchPrepend,
                    ChildTags = new List <ITag>()
                };
                break;
            }

            case "Dynamic":
            {
                tag = new Dynamic
                {
                    Prepend   = prepend,
                    ChildTags = new List <ITag>()
                };
                break;
            }

            case "Where":
            {
                tag = new Where
                {
                    ChildTags = new List <ITag>()
                };
                break;
            }

            case "Set":
            {
                tag = new Set
                {
                    ChildTags = new List <ITag>()
                };
                break;
            }

            case "For":
            {
                var open      = xmlNode?.GetAttribute("Open")?.Trim();
                var separator = xmlNode?.GetAttribute("Separator")?.Trim();
                var close     = xmlNode?.GetAttribute("Close")?.Trim();
                var key       = xmlNode?.GetAttribute("Key")?.Trim();
                var index     = xmlNode?.GetAttribute("Index")?.Trim();
                tag = new For
                {
                    Prepend   = prepend,
                    Property  = property,
                    Open      = open,
                    Close     = close,
                    Index     = index,
                    Separator = separator,
                    Key       = key,
                    ChildTags = new List <ITag>()
                };
                break;
            }

            case "Env":
            {
                var dbProvider = xmlNode?.GetAttribute("DbProvider")?.Trim();
                tag = new Env
                {
                    Prepend    = prepend,
                    DbProvider = dbProvider,
                    ChildTags  = new List <ITag>()
                };
                break;
            }

            case "#comment": { break; }

            default:
            {
                throw new SmartSqlException($"Statement.LoadTag unkonw tagName:{xmlNode.GetName()}.");
            };
            }
            #endregion
            if (tag != null)
            {
                tag.LineInfo = XmlLineInfo.Create(xmlNode);
            }
            if (xmlNode is XElement ell)
            {
                foreach (XNode childNode in ell.Nodes())
                {
                    ITag childTag = LoadTag(childNode, includes);
                    if (childTag != null && tag != null)
                    {
                        childTag.Parent = tag;
                        (tag as Tag).ChildTags.Add(childTag);
                    }
                }
            }
            return(tag);
        }
Exemplo n.º 14
0
        public static ITag LoadTag(XNode node)
        {
            ITag tag = null;

            if (node.NodeType == System.Xml.XmlNodeType.Text || node.NodeType == System.Xml.XmlNodeType.CDATA)
            {
                tag = new SqlText
                {
                    BodyText = node.ToString()
                };
            }
            if (node.NodeType == System.Xml.XmlNodeType.Element)
            {
                XElement elenode      = node as XElement;
                bool     isIn         = elenode.Attribute("In") != null;
                var      prepend      = elenode.Attribute("Prepend")?.Value.Trim();
                var      property     = elenode.Attribute("Property")?.Value.Trim();
                var      compareValue = elenode.Attribute("CompareValue")?.Value.Trim();
                var      nodeName     = elenode.Name.LocalName;
                switch (nodeName)
                {
                case "IsEmpty":
                {
                    tag = new IsEmpty
                    {
                        Prepend  = prepend,
                        Property = property,
                        Children = new List <ITag>()
                    };
                    break;
                }

                case "IsEqual":
                {
                    tag = new IsEqual
                    {
                        Prepend      = prepend,
                        Property     = property,
                        CompareValue = compareValue,
                        Children     = new List <ITag>()
                    };
                    break;
                }

                case "IsNotEqual":
                {
                    tag = new IsNotEqual
                    {
                        Prepend      = prepend,
                        CompareValue = compareValue,
                        Property     = property,
                        Children     = new List <ITag>()
                    };
                    break;
                }

                case "IsGreaterEqual":
                {
                    tag = new IsGreaterEqual
                    {
                        Prepend      = prepend,
                        Property     = property,
                        CompareValue = compareValue,
                    };
                    break;
                }

                case "IsGreaterThan":
                {
                    tag = new IsGreaterThan
                    {
                        Prepend      = prepend,
                        Property     = property,
                        CompareValue = compareValue,
                        Children     = new List <ITag>()
                    };
                    break;
                }

                case "IsLessEqual":
                {
                    tag = new IsLessEqual
                    {
                        Prepend      = prepend,
                        Property     = property,
                        CompareValue = compareValue,
                        Children     = new List <ITag>()
                    };
                    break;
                }

                case "IsLessThan":
                {
                    tag = new IsLessThan
                    {
                        Prepend      = prepend,
                        Property     = property,
                        CompareValue = compareValue,
                        Children     = new List <ITag>()
                    };
                    break;
                }

                case "IsNotEmpty":
                {
                    tag = new IsNotEmpty
                    {
                        Prepend  = prepend,
                        Property = property,
                        Children = new List <ITag>()
                    };
                    break;
                }

                case "IsNotNull":
                {
                    tag = new IsNotNull
                    {
                        Prepend  = prepend,
                        Property = property,
                        Children = new List <ITag>()
                    };
                    break;
                }

                case "IsNull":
                {
                    tag = new IsNull
                    {
                        Prepend  = prepend,
                        Property = property,
                        Children = new List <ITag>()
                    };
                    break;
                }

                case "Switch":
                {
                    tag = new Switch
                    {
                        // Prepend = prepend,
                        Property = property,
                        Children = new List <ITag>()
                    };
                    break;
                }

                case "Case":
                {
                    var switchNode     = node.Parent;
                    var switchProperty = switchNode.Attribute("Property")?.Value.Trim();
                    var switchPrepend  = switchNode.Attribute("Prepend")?.Value.Trim();
                    tag = new Switch.Case
                    {
                        Prepend      = switchPrepend,
                        Property     = switchProperty,
                        CompareValue = compareValue,
                        Children     = new List <ITag>()
                    };
                    break;
                }

                case "Default":
                {
                    var switchNode     = node.Parent;
                    var switchProperty = switchNode.Attribute("Property")?.Value.Trim();
                    var switchPrepend  = switchNode.Attribute("Prepend")?.Value.Trim();
                    tag = new Switch.Default
                    {
                        Prepend  = switchPrepend,
                        Property = switchProperty,
                        Children = new List <ITag>()
                    };
                    break;
                }

                case "Where":
                {
                    tag = new Where
                    {
                        Children = new List <ITag>()
                    };
                    break;
                }

                case "Dynamic":
                {
                    tag = new Dynamic
                    {
                        Prepend  = prepend,
                        Children = new List <ITag>()
                    };
                    break;
                }

                case "IsProperty":
                {
                    tag = new IsProperty
                    {
                        Prepend  = prepend,
                        Children = new List <ITag>(),
                        Property = property
                    };
                    break;
                }

                default:
                {
                    throw new BaraException($"Statement can't load TagName:{nodeName}");
                }
                }
                foreach (var childNode in elenode.Nodes())
                {
                    ITag childTag = LoadTag(childNode);
                    if (childTag != null && tag != null)
                    {
                        (tag as Tag).Children.Add(childTag);
                    }
                }
            }
            return(tag);
        }
Exemplo n.º 15
0
        public ITag Build(XmlNode xmlNode)
        {
            ITag tag          = null;
            var  prepend      = xmlNode.Attributes?["Prepend"]?.Value.Trim();
            var  property     = xmlNode.Attributes?["Property"]?.Value.Trim();
            var  compareValue = xmlNode.Attributes?["CompareValue"]?.Value.Trim();

            #region Init Tag
            switch (xmlNode.Name)
            {
            case "#text":
            case "#cdata-section":
            {
                var bodyText = " " + xmlNode.InnerText.Replace("\n", "").Trim();
                return(new SqlText
                    {
                        BodyText = bodyText
                    });
            }

            case "Include":
            {
                var refId       = xmlNode.Attributes?["RefId"]?.Value;
                var include_tag = new Include
                {
                    RefId   = refId,
                    Prepend = prepend
                };
                //includes.Add(include_tag);
                tag = include_tag;
                break;
            }

            case "IsEmpty":
            {
                tag = new IsEmpty
                {
                    Prepend   = prepend,
                    Property  = property,
                    ChildTags = new List <ITag>()
                };
                break;
            }

            case "IsEqual":
            {
                tag = new IsEqual
                {
                    Prepend      = prepend,
                    Property     = property,
                    CompareValue = compareValue,
                    ChildTags    = new List <ITag>()
                };
                break;
            }

            case "IsGreaterEqual":
            {
                tag = new IsGreaterEqual
                {
                    Prepend      = prepend,
                    Property     = property,
                    CompareValue = compareValue,
                    ChildTags    = new List <ITag>()
                };
                break;
            }

            case "IsGreaterThan":
            {
                tag = new IsGreaterThan
                {
                    Prepend      = prepend,
                    Property     = property,
                    CompareValue = compareValue,
                    ChildTags    = new List <ITag>()
                };
                break;
            }

            case "IsLessEqual":
            {
                tag = new IsLessEqual
                {
                    Prepend      = prepend,
                    Property     = property,
                    CompareValue = compareValue,
                    ChildTags    = new List <ITag>()
                };
                break;
            }

            case "IsLessThan":
            {
                tag = new IsLessThan
                {
                    Prepend      = prepend,
                    Property     = property,
                    CompareValue = compareValue,
                    ChildTags    = new List <ITag>()
                };
                break;
            }

            case "IsNotEmpty":
            {
                tag = new IsNotEmpty
                {
                    Prepend   = prepend,
                    Property  = property,
                    ChildTags = new List <ITag>()
                };
                break;
            }

            case "IsNotEqual":
            {
                tag = new IsNotEqual
                {
                    Prepend      = prepend,
                    Property     = property,
                    CompareValue = compareValue,
                    ChildTags    = new List <ITag>()
                };
                break;
            }

            case "IsNotNull":
            {
                tag = new IsNotNull
                {
                    Prepend   = prepend,
                    Property  = property,
                    ChildTags = new List <ITag>()
                };
                break;
            }

            case "IsNull":
            {
                tag = new IsNull
                {
                    Prepend   = prepend,
                    Property  = property,
                    ChildTags = new List <ITag>()
                };
                break;
            }

            case "IsTrue":
            {
                tag = new IsTrue
                {
                    Prepend   = prepend,
                    Property  = property,
                    ChildTags = new List <ITag>()
                };
                break;
            }

            case "IsFalse":
            {
                tag = new IsFalse
                {
                    Prepend   = prepend,
                    Property  = property,
                    ChildTags = new List <ITag>()
                };
                break;
            }

            case "IsProperty":
            {
                tag = new IsProperty
                {
                    Prepend   = prepend,
                    Property  = property,
                    ChildTags = new List <ITag>()
                };
                break;
            }

            case "Placeholder":
            {
                tag = new Placeholder
                {
                    Prepend   = prepend,
                    Property  = property,
                    ChildTags = new List <ITag>()
                };
                break;
            }

            case "Switch":
            {
                tag = new Switch
                {
                    Property  = property,
                    Prepend   = prepend,
                    ChildTags = new List <ITag>()
                };
                break;
            }

            case "Case":
            {
                var switchNode     = xmlNode.ParentNode;
                var switchProperty = switchNode.Attributes?["Property"]?.Value.Trim();
                var switchPrepend  = switchNode.Attributes?["Prepend"]?.Value.Trim();
                tag = new Switch.Case
                {
                    CompareValue = compareValue,
                    Property     = switchProperty,
                    Prepend      = switchPrepend,
                    Test         = xmlNode.Attributes?["Test"]?.Value.Trim(),
                    ChildTags    = new List <ITag>()
                };
                break;
            }

            case "Bind":
            {
                tag = new BindTag
                {
                    Name  = xmlNode.Attributes["Name"]?.Value,
                    Value = xmlNode.Attributes["Value"]?.Value,
                };
                break;
            }

            case "Trim":
            {
                tag = new TrimTag
                {
                    Prefix          = xmlNode.Attributes["Prefix"]?.Value,
                    PrefixOverrides = xmlNode.Attributes["PrefixOverrides"]?.Value,
                    Suffix          = xmlNode.Attributes["Suffix"]?.Value,
                    ChildTags       = new List <ITag>()
                };
                break;
            }

            case "Default":
            {
                var switchNode     = xmlNode.ParentNode;
                var switchProperty = switchNode.Attributes?["Property"]?.Value.Trim();
                var switchPrepend  = switchNode.Attributes?["Prepend"]?.Value.Trim();
                tag = new Switch.Defalut
                {
                    Property  = switchProperty,
                    Prepend   = switchPrepend,
                    ChildTags = new List <ITag>()
                };
                break;
            }

            case "Dynamic":
            {
                tag = new Dynamic
                {
                    Prepend   = prepend,
                    ChildTags = new List <ITag>()
                };
                break;
            }

            case "Where":
            {
                tag = new Where
                {
                    ChildTags = new List <ITag>()
                };
                break;
            }

            case "If":
            {
                var test = xmlNode.Attributes["Test"]?.Value;
                tag = new IfTag
                {
                    Test = test
                };
            }
            break;

            case "Set":
            {
                tag = new Set
                {
                    ChildTags = new List <ITag>()
                };
                break;
            }

            case "For":
            {
                var open      = xmlNode.Attributes?["Open"]?.Value.Trim();
                var separator = xmlNode.Attributes?["Separator"]?.Value.Trim();
                var close     = xmlNode.Attributes?["Close"]?.Value.Trim();
                var key       = xmlNode.Attributes?["Key"]?.Value.Trim();
                tag = new For
                {
                    Prepend   = prepend,
                    Property  = property,
                    Open      = open,
                    Close     = close,
                    Separator = separator,
                    Key       = key,
                    ChildTags = new List <ITag>()
                };
                break;
            }

            case "Env":
            {
                var dbProvider = xmlNode.Attributes?["DbProvider"]?.Value.Trim();
                tag = new Env
                {
                    Prepend    = prepend,
                    DbProvider = dbProvider,
                    ChildTags  = new List <ITag>()
                };
                break;
            }

            case "#comment": { break; }

            default:
            {
                throw new SmartSqlException($"Statement.LoadTag unkonw tagName:{xmlNode.Name}.");
            };
            }
            #endregion
            return(tag);
        }
Exemplo n.º 16
0
        public static ITag LoadTag(XmlNode xmlNode, IList <Include> includes)
        {
            ITag tag          = null;
            bool isIn         = !string.IsNullOrEmpty(xmlNode.GetValueInXmlAttributes("In"));
            var  prepend      = xmlNode.GetValueInXmlAttributes("Prepend");
            var  property     = xmlNode.GetValueInXmlAttributes("Property");
            var  compareValue = xmlNode.GetValueInXmlAttributes("CompareValue");

            #region Init Tag
            string lowerXmlNodeName = xmlNode.Name.ToLower();
            switch (lowerXmlNodeName)
            {
            case "#text":
            case "#cdata-section":
            {
                var bodyText = " " + xmlNode.GetInnerTextInXmlAttributes();
                return(new SqlText
                    {
                        BodyText = bodyText
                    });
            }

            //case "OrderBy":
            case "orderby":
            {
                var bodyText = " " + xmlNode.GetInnerTextInXmlAttributes();
                tag = new OrderBy
                {
                    ChildTags = new List <ITag>(),

                    BodyText = bodyText
                };
                break;
            }

            //case "Include":
            case "include":
            {
                var refId       = xmlNode.GetValueInXmlAttributes("RefId");
                var include_tag = new Include
                {
                    RefId = refId
                };
                includes.Add(include_tag);
                tag = include_tag;
                break;
            }

            //case "If":
            case "if":
            {
                var Test = xmlNode.GetValueInXmlAttributes("Test");
                tag = new IfTag
                {
                    Test      = Test,
                    Prepend   = prepend,
                    Property  = property,
                    ChildTags = new List <ITag>()
                };
                break;
            }

            //case "IsEmpty":
            case "isempty":
            {
                tag = new IsEmpty
                {
                    In        = isIn,
                    Prepend   = prepend,
                    Property  = property,
                    ChildTags = new List <ITag>()
                };
                break;
            }

            //case "IsEqual":
            case "isequal":
            {
                tag = new IsEqual
                {
                    In           = isIn,
                    Prepend      = prepend,
                    Property     = property,
                    CompareValue = compareValue,
                    ChildTags    = new List <ITag>()
                };
                break;
            }

            //case "IsGreaterEqual":
            case "isgreaterequal":
            {
                tag = new IsGreaterEqual
                {
                    In           = isIn,
                    Prepend      = prepend,
                    Property     = property,
                    CompareValue = compareValue,
                    ChildTags    = new List <ITag>()
                };
                break;
            }

            //case "IsGreaterThan":
            case "isgreaterthan":
            {
                tag = new IsGreaterThan
                {
                    In           = isIn,
                    Prepend      = prepend,
                    Property     = property,
                    CompareValue = compareValue,
                    ChildTags    = new List <ITag>()
                };
                break;
            }

            //case "IsLessEqual":
            case "islessequal":
            {
                tag = new IsLessEqual
                {
                    In           = isIn,
                    Prepend      = prepend,
                    Property     = property,
                    CompareValue = compareValue,
                    ChildTags    = new List <ITag>()
                };
                break;
            }

            //case "IsLessThan":
            case "islessthan":
            {
                tag = new IsLessThan
                {
                    In           = isIn,
                    Prepend      = prepend,
                    Property     = property,
                    CompareValue = compareValue,
                    ChildTags    = new List <ITag>()
                };
                break;
            }

            //case "IsNotEmpty":
            case "isnotempty":
            {
                tag = new IsNotEmpty
                {
                    In        = isIn,
                    Prepend   = prepend,
                    Property  = property,
                    ChildTags = new List <ITag>()
                };
                break;
            }

            //case "IsNotEqual":
            case "isnotequal":
            {
                tag = new IsNotEqual
                {
                    In           = isIn,
                    Prepend      = prepend,
                    Property     = property,
                    CompareValue = compareValue,
                    ChildTags    = new List <ITag>()
                };
                break;
            }

            //case "IsNotNull":
            case "isnotnull":
            {
                tag = new IsNotNull
                {
                    In        = isIn,
                    Prepend   = prepend,
                    Property  = property,
                    ChildTags = new List <ITag>()
                };
                break;
            }

            //case "IsNull":
            case "isnull":
            {
                tag = new IsNull
                {
                    In        = isIn,
                    Prepend   = prepend,
                    Property  = property,
                    ChildTags = new List <ITag>()
                };
                break;
            }

            //case "IsTrue":
            case "istrue":
            {
                tag = new IsTrue
                {
                    In        = isIn,
                    Prepend   = prepend,
                    Property  = property,
                    ChildTags = new List <ITag>()
                };
                break;
            }

            //case "IsFalse":
            case "isfalse":
            {
                tag = new IsFalse
                {
                    In        = isIn,
                    Prepend   = prepend,
                    Property  = property,
                    ChildTags = new List <ITag>()
                };
                break;
            }

            //case "IsProperty":
            case "isproperty":
            {
                tag = new IsProperty
                {
                    In        = isIn,
                    Prepend   = prepend,
                    Property  = property,
                    ChildTags = new List <ITag>()
                };
                break;
            }

            //case "Switch":
            case "switch":
            {
                tag = new Switch
                {
                    Property = property,
                    //Prepend = prepend,
                    ChildTags = new List <ITag>()
                };
                break;
            }

            //case "Case":
            case "case":
            {
                var switchNode     = xmlNode.ParentNode;
                var switchProperty = switchNode.GetValueInXmlAttributes("Property");
                var switchPrepend  = switchNode.GetValueInXmlAttributes("Prepend");
                tag = new Switch.Case
                {
                    CompareValue = compareValue,
                    Property     = switchProperty,
                    Prepend      = switchPrepend,
                    ChildTags    = new List <ITag>()
                };
                break;
            }

            //case "Default":
            case "default":
            {
                var switchNode     = xmlNode.ParentNode;
                var switchProperty = switchNode.GetValueInXmlAttributes("Property");
                var switchPrepend  = switchNode.GetValueInXmlAttributes("Prepend");
                tag = new Switch.Defalut
                {
                    Property  = switchProperty,
                    Prepend   = switchPrepend,
                    ChildTags = new List <ITag>()
                };
                break;
            }

            //case "Choose":
            case "choose":
            {
                tag = new ChooseTag
                {
                    //Property = property,
                    //Prepend = prepend,
                    ChildTags = new List <ITag>()
                };
                break;
            }

            case "when":
            {
                var Test = xmlNode.GetValueInXmlAttributes("Test");
                //var switchNode = xmlNode.ParentNode;
                //var switchProperty = switchNode.GetValueInXmlAttributes("Property");
                //var switchPrepend = switchNode.GetValueInXmlAttributes("Prepend");
                tag = new ChooseTag.ChooseWhenTag
                {
                    Test = Test,
                    //Property = switchProperty,
                    //Prepend = switchPrepend,
                    ChildTags = new List <ITag>()
                };
                break;
            }

            case "otherwise":
            {
                //var switchNode = xmlNode.ParentNode;
                //var switchProperty = switchNode.GetValueInXmlAttributes("Property");
                //var switchPrepend = switchNode.GetValueInXmlAttributes("Prepend");
                tag = new ChooseTag.ChooseOtherwiseTag
                {
                    //Property = switchProperty,
                    //Prepend = switchPrepend,
                    ChildTags = new List <ITag>()
                };
                break;
            }

            case "trim":
            {
                var Prefix          = xmlNode.GetValueInXmlAttributes("Prefix", "", false);
                var Suffix          = xmlNode.GetValueInXmlAttributes("Suffix", "", false);
                var PrefixOverrides = xmlNode.GetValueInXmlAttributes("PrefixOverrides");
                var SuffixOverrides = xmlNode.GetValueInXmlAttributes("SuffixOverrides");
                tag = new TrimTag
                {
                    Prefix          = Prefix,
                    Suffix          = Suffix,
                    PrefixOverrides = PrefixOverrides,
                    SuffixOverrides = SuffixOverrides,
                    ChildTags       = new List <ITag>()
                };
                break;
            }

            case "set":
            {
                tag = new SetTag()
                {
                    ChildTags = new List <ITag>()
                };
                break;
            }

            case "where":
            {
                tag = new WhereTag
                {
                    ChildTags = new List <ITag>()
                };
                break;
            }

            //case "Where":
            //case "where":
            //    {
            //        tag = new Where
            //        {
            //            ChildTags = new List<ITag>()
            //        };
            //        break;
            //    }
            //case "Dynamic":
            case "dynamic":
            {
                tag = new Dynamic
                {
                    Prepend   = prepend,
                    ChildTags = new List <ITag>()
                };
                break;
            }

            //case "Variable":
            case "variable":
            {
                var bodyText = xmlNode.GetInnerTextInXmlAttributes();
                tag = new Variable
                {
                    BodyText  = bodyText,
                    Prepend   = prepend,
                    Property  = property,
                    ChildTags = new List <ITag>()
                };
                break;
            }

            //case "Bind":
            case "bind":
            {
                var Name  = xmlNode.GetValueInXmlAttributes("Name");
                var Value = xmlNode.GetValueInXmlAttributes("Value");
                //var bodyText = xmlNode.GetInnerTextInXmlAttributes();
                tag = new BindTag
                {
                    Name      = Name,
                    Value     = Value,
                    Prepend   = prepend,
                    Property  = property,
                    ChildTags = new List <ITag>()
                };
                break;
            }

            //case "Foreach":
            case "foreach":
            {
                var open      = xmlNode.GetValueInXmlAttributes("Open");
                var separator = xmlNode.GetValueInXmlAttributes("Separator");
                var close     = xmlNode.GetValueInXmlAttributes("Close");
                var item      = xmlNode.GetValueInXmlAttributes("Item");
                var index     = xmlNode.GetValueInXmlAttributes("Index");
                tag = new Foreach
                {
                    Prepend   = prepend,
                    Property  = property,
                    Open      = open,
                    Close     = close,
                    Separator = separator,
                    Item      = item,
                    Index     = index,
                    ChildTags = new List <ITag>()
                };
                break;
            }

            //case "Env":
            case "env":
            {
                var dbProvider = xmlNode.GetValueInXmlAttributes("DbProvider");
                var DbType     = xmlNode.GetValueInXmlAttributes("DbType");
                tag = new Env
                {
                    Prepend    = prepend,
                    DbProvider = dbProvider,
                    DbType     = DbType,
                    ChildTags  = new List <ITag>()
                };
                break;
            }

            case "#comment": { break; }

            default:
            {
                throw new Exception(string.Format("Statement.LoadTag unkonw tagName:{0}.", xmlNode.Name));
            };
            }
            #endregion
            //加载组合查询条件查询
            foreach (XmlNode childNode in xmlNode)
            {
                ITag childTag = LoadTag(childNode, includes);
                if (childTag != null && tag != null)
                {
                    (tag as Tag).ChildTags.Add(childTag);
                }
            }
            return(tag);
        }