示例#1
0
 /// <summary>
 /// Performs a joint of two tables.
 /// </summary>
 /// <returns></returns>
 public static QueryResults <Joined> JoinAsync <Joined, Selectable1, T1, Selectable2, T2, Key>(
     Node <object> table1, IJoinExpression <Selectable1, T1, Key> expression1,
     Node <object> table2, IJoinExpression <Selectable2, T2, Key> expression2,
     JoinDelegate <Joined, Selectable1, Selectable2> customJoin)
     where Key : IComparable <Key>
 {
     return(null);
 }
示例#2
0
        /// <summary>
        /// Set a method that resolves the <c>JOIN</c> condition.
        /// </summary>
        /// <param name="fieldConfig">The field config.</param>
        /// <param name="join">The JOIN condition resolver.</param>
        /// <returns>The <see cref="FieldConfig"/></returns>
        /// <exception cref="ArgumentNullException">If <paramref name="fieldConfig"/> or <paramref name="join"/> is <c>null</c>.</exception>
        public static FieldConfig SqlJoin(this FieldConfig fieldConfig, JoinDelegate join)
        {
            if (fieldConfig == null)
            {
                throw new ArgumentNullException(nameof(fieldConfig));
            }
            if (join == null)
            {
                throw new ArgumentNullException(nameof(join));
            }

            fieldConfig.Resolver ??= DictionaryFieldResolver.Instance;

            return(fieldConfig.WithMetadata(nameof(JoinDelegate), join));
        }
示例#3
0
        /// <summary>
        /// Create a new instance of the <see cref="SqlJunctionConfigBuilder"/> configured for joining the junction table.
        /// </summary>
        /// <param name="tableName">The junction table name.</param>
        /// <param name="fromParent">The JOIN condition when joining from the parent table to the junction table.</param>
        /// <param name="toChild">The JOIN condition when joining from the junction table to the child table.</param>
        /// <returns>The <see cref="SqlJunctionConfigBuilder"/>.</returns>
        /// <exception cref="ArgumentNullException">If <paramref name="tableName"/>, <paramref name="fromParent"/> or <paramref name="toChild"/> is <c>null</c>.</exception>
        public static SqlJunctionConfigBuilder Create(string tableName, JoinDelegate fromParent, JoinDelegate toChild)
        {
            if (tableName == null)
            {
                throw new ArgumentNullException(nameof(tableName));
            }
            if (fromParent == null)
            {
                throw new ArgumentNullException(nameof(fromParent));
            }
            if (toChild == null)
            {
                throw new ArgumentNullException(nameof(toChild));
            }

            var config = new SqlJunctionConfig(tableName, fromParent, toChild);

            return(new SqlJunctionConfigBuilder(config));
        }
示例#4
0
        /// <summary>
        /// Configure a SQL Junction.
        /// </summary>
        /// <param name="fieldConfig">The field config.</param>
        /// <param name="tableName">The table name.</param>
        /// <param name="fromParent">The JOIN condition when joining from the parent table to the junction table.</param>
        /// <param name="toChild">The JOIN condition when joining from the junction table to the child table.</param>
        /// <returns>The <see cref="SqlJunctionConfigBuilder"/>.</returns>
        /// <exception cref="ArgumentNullException">If <paramref name="fieldConfig"/> is <c>null</c>.</exception>
        public static SqlJunctionConfigBuilder SqlJunction(this FieldConfig fieldConfig, string tableName, JoinDelegate fromParent, JoinDelegate toChild)
        {
            if (fieldConfig == null)
            {
                throw new ArgumentNullException(nameof(fieldConfig));
            }

            var builder = SqlJunctionConfigBuilder.Create(tableName, fromParent, toChild);

            fieldConfig.WithMetadata(nameof(SqlJunctionConfig), builder.SqlJunctionConfig);
            fieldConfig.Resolver ??= DictionaryFieldResolver.Instance;

            return(builder);
        }
示例#5
0
        /// <summary>
        /// Create a new instance of the <see cref="SqlJunctionConfigBuilder"/> configured for batching the many-to-many query.
        /// </summary>
        /// <param name="fieldType">The <see cref="FieldType"/>.</param>
        /// <param name="tableName">The junction table name.</param>
        /// <param name="uniqueKey">The unique key columns.</param>
        /// <param name="thisKey">The column to match on the current table.</param>
        /// <param name="parentKey">The column to match in the parent table.</param>
        /// <param name="join">The JOIN condition when joining from the junction table to the related table.</param>
        /// <returns>The <see cref="SqlJunctionConfigBuilder"/>.</returns>
        /// <exception cref="ArgumentNullException">If <paramref name="fieldType"/>, <paramref name="tableName"/>, <paramref name="uniqueKey"/>, <paramref name="thisKey"/>, <paramref name="parentKey"/> or <paramref name="join"/> is <c>null</c>.</exception>
        public static SqlJunctionConfigBuilder SqlJunction(this FieldType fieldType, string tableName, string[] uniqueKey, string thisKey, string parentKey, JoinDelegate join)
        {
            if (fieldType == null)
            {
                throw new ArgumentNullException(nameof(fieldType));
            }
            if (tableName == null)
            {
                throw new ArgumentNullException(nameof(tableName));
            }
            if (thisKey == null)
            {
                throw new ArgumentNullException(nameof(thisKey));
            }
            if (parentKey == null)
            {
                throw new ArgumentNullException(nameof(parentKey));
            }
            if (join == null)
            {
                throw new ArgumentNullException(nameof(join));
            }

            var builder = SqlJunctionConfigBuilder.Create(tableName, uniqueKey, thisKey, parentKey, join);

            fieldType.WithMetadata(nameof(SqlJunctionConfig), builder.SqlJunctionConfig);
            return(builder);
        }
示例#6
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="join">The JOIN condition when joining from the junction table to the related table.</param>
 /// <returns>The <see cref="SqlBatchConfigBuilder"/>.</returns>
 public SqlBatchConfigBuilder Join(JoinDelegate join)
 {
     SqlBatchConfig.Join = join;
     return(this);
 }
示例#7
0
        /// <summary>
        /// Create a new instance of the <see cref="SqlJunctionConfigBuilder"/> configured for batching the many-to-many query.
        /// </summary>
        /// <param name="tableName">The junction table name.</param>
        /// <param name="uniqueKey">The unique key columns.</param>
        /// <param name="thisKey">The column to match on the current table.</param>
        /// <param name="parentKey">The column to match in the parent table.</param>
        /// <param name="join">The JOIN condition when joining from the junction table to the related table.</param>
        /// <returns>The <see cref="SqlJunctionConfigBuilder"/>.</returns>
        /// <exception cref="ArgumentNullException">If <paramref name="tableName"/>, <paramref name="uniqueKey"/>, <paramref name="thisKey"/>, <paramref name="parentKey"/> or <paramref name="join"/> is <c>null</c>.</exception>
        public static SqlJunctionConfigBuilder Create(string tableName, string[] uniqueKey, string thisKey, string parentKey, JoinDelegate join)
        {
            if (tableName == null)
            {
                throw new ArgumentNullException(nameof(tableName));
            }
            if (thisKey == null)
            {
                throw new ArgumentNullException(nameof(thisKey));
            }
            if (parentKey == null)
            {
                throw new ArgumentNullException(nameof(parentKey));
            }
            if (join == null)
            {
                throw new ArgumentNullException(nameof(join));
            }

            var sqlBatchBuilder = SqlBatchConfigBuilder
                                  .Create(thisKey, parentKey)
                                  .Join(join);

            var config = new SqlJunctionConfig(tableName, uniqueKey, sqlBatchBuilder.SqlBatchConfig);

            return(new SqlJunctionConfigBuilder(config));
        }
示例#8
0
 /// <summary>
 /// Установить описание комнаты
 /// </summary>
 /// <param name="match"></param>
 /// <param name="joinDelegateCallback"></param>
 public void Setup(MatchInfoSnapshot match, JoinDelegate joinDelegateCallback)
 {
     this.match = match;
     this.joinDelegateCallback = joinDelegateCallback;
     roomNameText.text         = match.name + " (" + match.currentSize + "/" + match.maxSize + ")";
 }
示例#9
0
        /// <summary>
        /// Set a method that resolves the LEFT JOIN condition.
        /// </summary>
        /// <param name="builder">The connection builder.</param>
        /// <param name="join">The JOIN condition resolver.</param>
        /// <returns>The <see cref="ConnectionBuilder{T}"/>.</returns>
        /// <exception cref="ArgumentNullException">If <paramref name="builder"/> or <paramref name="join"/> is <c>null</c>.</exception>
        public static ConnectionBuilder <T> SqlJoin <T>(this ConnectionBuilder <T> builder, JoinDelegate join)
        {
            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }
            if (join == null)
            {
                throw new ArgumentNullException(nameof(join));
            }

            builder.FieldType.SqlJoin(join);

            return(builder);
        }
示例#10
0
 /// <summary>
 /// Creates a new instance of <see cref="SqlJunctionConfig"/> configured for joining the junction table.
 /// </summary>
 /// <param name="table">The junction table name.</param>
 /// <param name="fromParent">The JOIN condition when joining from the parent table to the junction table.</param>
 /// <param name="toChild">The JOIN condition when joining from the junction table to the child table.</param>
 /// <exception cref="ArgumentNullException">If <paramref name="table"/>, <paramref name="fromParent"/> or <paramref name="toChild"/> is <c>null</c>.</exception>
 public SqlJunctionConfig(string table, JoinDelegate fromParent, JoinDelegate toChild)
 {
     Table      = table ?? throw new ArgumentNullException(nameof(table));
     FromParent = fromParent ?? throw new ArgumentNullException(nameof(fromParent));
     ToChild    = toChild ?? throw new ArgumentNullException(nameof(toChild));
 }