コード例 #1
0
ファイル: Join.cs プロジェクト: kobynet/SQLGeneration
 /// <summary>
 /// Starts creating a BinaryJoin.
 /// </summary>
 /// <param name="source">The table or select statement to start the join series with.</param>
 /// <param name="alias">The alias to give the item.</param>
 /// <returns>The first join item.</returns>
 public static Join From(IRightJoinItem source, string alias = null)
 {
     if (source == null)
     {
         throw new ArgumentNullException("source");
     }
     AliasedSource start = new AliasedSource(source, alias);
     return new JoinStart(start);
 }
コード例 #2
0
        /// <summary>
        /// Starts creating a BinaryJoin.
        /// </summary>
        /// <param name="source">The table or select statement to start the join series with.</param>
        /// <param name="alias">The alias to give the item.</param>
        /// <returns>The first join item.</returns>
        public static Join From(IRightJoinItem source, string alias = null)
        {
            if (source == null)
            {
                throw new ArgumentNullException("source");
            }
            AliasedSource start = new AliasedSource(source, alias);

            return(new JoinStart(start));
        }
コード例 #3
0
ファイル: LogUtils.cs プロジェクト: noriy0363/CrmAdo
        public static void LogAliasedSource(AliasedSource source, StringBuilder stringBuilder, int level = 0)
        {
            var indent = GetIndent(level);

            if (source != null)
            {
                stringBuilder.AppendLine(string.Format("{0} {1}", indent, source.GetType().FullName));
                if (!string.IsNullOrEmpty(source.Alias))
                {
                    stringBuilder.AppendLine(string.Format("{0} Alias: {1}", indent, source.Alias));
                }

                if (source.Source != null)
                {
                    IRightJoinItem joinItem   = source.Source;
                    var            sourceName = joinItem.GetSourceName();
                    stringBuilder.AppendLine(string.Format("{0} {1}", indent, joinItem.GetType().FullName));
                    stringBuilder.AppendLine(string.Format("{0} Source Name: {1}", indent, sourceName));

                    //if (joinItem.IsTable)
                    //{
                    var table = joinItem as Table;
                    stringBuilder.AppendLine(string.Format("{0}   Table Name: {1}", indent, table.Name));
                    stringBuilder.AppendLine(string.Format("{0}   Table Qualifier: {1}", indent, table.Qualifier));
                    //  }
                    // else
                    //{
                    //    var join = joinItem as Join;
                    //    if (join != null)
                    //    {
                    //        LogJoin(join, stringBuilder, level + 1);
                    //    }
                    //    else
                    //    {
                    //        throw new NotSupportedException();
                    //    }

                    //}
                }
            }
        }
コード例 #4
0
 /// <summary>
 /// Initializes a new instance of an AliasedSource.
 /// </summary>
 /// <param name="source">The table or SELECT statement acting as the source.</param>
 /// <param name="alias">The alias to refer to the source with.</param>
 internal AliasedSource(IRightJoinItem source, string alias)
 {
     Source = source;
     Alias  = alias;
 }
コード例 #5
0
        /// <summary>
        /// Creates a new join where the given item is inner joined with the existing join items.
        /// </summary>
        /// <param name="item">The item to join with.</param>
        /// <param name="alias">The alias to give the item.</param>
        /// <returns>The new join.</returns>
        public FilteredJoin InnerJoin(IRightJoinItem item, string alias = null)
        {
            AliasedSource source = new AliasedSource(item, alias);

            return(new InnerJoin(this, source));
        }
コード例 #6
0
        /// <summary>
        /// Creates a new join where the given item is cross joined with the existing join items.
        /// </summary>
        /// <param name="item">The item to join with.</param>
        /// <param name="alias">The alias to give the item.</param>
        /// <returns>The new join.</returns>
        public Join CrossJoin(IRightJoinItem item, string alias = null)
        {
            AliasedSource source = new AliasedSource(item, alias);

            return(new CrossJoin(this, source));
        }
コード例 #7
0
 private FilteredJoin buildFilteredJoin(MatchResult result, Join join, IRightJoinItem joinItem, string alias)
 {
     MatchResult innerResult = result.Matches[SqlGrammar.FilteredJoinType.InnerJoin];
     if (innerResult.IsMatch)
     {
         return join.InnerJoin(joinItem, alias);
     }
     MatchResult leftResult = result.Matches[SqlGrammar.FilteredJoinType.LeftOuterJoin];
     if (leftResult.IsMatch)
     {
         return join.LeftOuterJoin(joinItem, alias);
     }
     MatchResult rightResult = result.Matches[SqlGrammar.FilteredJoinType.RightOuterJoin];
     if (rightResult.IsMatch)
     {
         return join.RightOuterJoin(joinItem, alias);
     }
     MatchResult fullResult = result.Matches[SqlGrammar.FilteredJoinType.FullOuterJoin];
     if (fullResult.IsMatch)
     {
         return join.FullOuterJoin(joinItem, alias);
     }
     throw new InvalidOperationException();
 }
コード例 #8
0
 /// <summary>
 /// Initializes a new instance of an AliasedSource.
 /// </summary>
 /// <param name="source">The table or SELECT statement acting as the source.</param>
 /// <param name="alias">The alias to refer to the source with.</param>
 internal AliasedSource(IRightJoinItem source, string alias)
 {
     Source = source;
     Alias = alias;
 }
コード例 #9
0
ファイル: Join.cs プロジェクト: kobynet/SQLGeneration
 /// <summary>
 /// Creates a new join where the given item is cross joined with the existing join items.
 /// </summary>
 /// <param name="item">The item to join with.</param>
 /// <param name="alias">The alias to give the item.</param>
 /// <returns>The new join.</returns>
 public Join CrossJoin(IRightJoinItem item, string alias = null)
 {
     AliasedSource source = new AliasedSource(item, alias);
     return new CrossJoin(this, source);
 }
コード例 #10
0
ファイル: Join.cs プロジェクト: kobynet/SQLGeneration
 /// <summary>
 /// Creates a new join where the given item is right outer joined with the existing join items.
 /// </summary>
 /// <param name="item">The item to join with.</param>
 /// <param name="alias">The alias to give the item.</param>
 /// <returns>The new join.</returns>
 public FilteredJoin RightOuterJoin(IRightJoinItem item, string alias = null)
 {
     AliasedSource source = new AliasedSource(item, alias);
     return new RightOuterJoin(this, source);
 }