Exemplo n.º 1
0
        public override void WriteToStream(IndentStream stream)
        {
            stream.Write("MERGE");

            if (!string.IsNullOrEmpty(IntoToken))
            {
                stream.Write($" {IntoToken}");
            }

            stream.Write(" ");
            TargetTable.WriteToStream(stream);

            if (WithOptions != null && WithOptions.Count > 0)
            {
                stream.Write(" WITH(");
                WithOptions.WriteToStreamWithComma(stream);
                stream.Write(")");
            }

            if (TargetTableAliasName != null)
            {
                stream.Write(" AS ");
                TargetTableAliasName.WriteToStream(stream);
            }

            stream.WriteLine();
            stream.Write("USING ");
            TableSource.WriteToStream(stream);

            if (TableSourceAliasName != null)
            {
                stream.Write(" AS ");
                TableSourceAliasName.WriteToStream(stream);
            }

            if (SourceColumnList != null && SourceColumnList.Count > 0)
            {
                stream.Write("(");
                SourceColumnList.WriteToStreamWithComma(stream);
                stream.Write(")");
            }

            stream.Write(" ON ");
            OnMergeSearchCondition.WriteToStream(stream);

            if (WhenList != null && WhenList.Count > 0)
            {
                stream.WriteLine();
                WhenList.WriteToStream(stream);
            }

            if (OutputList != null && OutputList.Count > 0)
            {
                stream.WriteLine();
                stream.Write("OUTPUT ");
                OutputList.WriteToStreamWithComma(stream);
            }

            stream.Write(" ;");
        }
Exemplo n.º 2
0
        public bool Contains(string searchKeyword)
        {
            string lowerSearchKeyword = searchKeyword.ToLower();

            return(Description.ToLower().Contains(lowerSearchKeyword) ||
                   WhenList.Any(when => when.ToLower().Contains(lowerSearchKeyword)) ||
                   ThenList.Any(then => then.Description.ToLower().Contains(lowerSearchKeyword)) ||
                   Children.Any(child => child.Contains(lowerSearchKeyword)));
        }
Exemplo n.º 3
0
 public bool IsEmpty()
 {
     return(!WhenList.Any() && !ThenList.Any() && Children.All(c => c.IsEmpty()));
 }