コード例 #1
0
        /// <summary>
        /// 指定された型情報から対象となるテーブルのレコードを取得するクエリを生成します。
        /// </summary>
        /// <typeparam name="T">テーブルの型</typeparam>
        /// <param name="properties">抽出する列にマッピングされるプロパティのコレクション。指定がない場合はすべての列を抽出対象とします。</param>
        /// <returns>生成されたSQL</returns>
        public static string CreateSelect <T>(Expression <Func <T, object> > properties = null)
        {
            var propertyNames = properties == null
                                ? null
                                : ExpressionHelper.GetMemberNames(properties);

            return(This.CreateSelect(typeof(T), propertyNames));
        }
コード例 #2
0
        public static string CreateUpdate <T>(DbKind targetDatabase, bool setIdentity, params Expression <Func <T, object> >[] properties)
        {
            var propertyNames = properties == null || properties.Length == 0
                                ? null
                                : ExpressionHelper.GetMemberNames(properties);

            return(This.CreateUpdate(targetDatabase, typeof(T), propertyNames, setIdentity));
        }
コード例 #3
0
        public static string CreateSelect <T>(params Expression <Func <T, object> >[] properties)
        {
            var propertyNames = properties == null || properties.Length == 0
                                ? null
                                : ExpressionHelper.GetMemberNames(properties);

            return(This.CreateSelect(typeof(T), propertyNames));
        }
コード例 #4
0
        /// <summary>
        /// 指定された型情報から、対象となるテーブルのレコードを指定されたプロパティにマッピングされている列に絞って更新するクエリを生成します。
        /// </summary>
        /// <typeparam name="T">テーブルの型</typeparam>
        /// <param name="targetDatabase">対象データベース</param>
        /// <param name="properties">抽出する列にマッピングされるプロパティのコレクション。指定がない場合はすべての列を抽出対象とします。</param>
        /// <param name="setIdentity">自動採番のID列に値を設定するかどうか</param>
        /// <returns>生成されたSQL</returns>
        public static string CreateUpdate <T>(DbKind targetDatabase, Expression <Func <T, object> > properties = null, bool setIdentity = false)
        {
            var propertyNames = properties == null
                                ? null
                                : ExpressionHelper.GetMemberNames(properties);

            return(This.CreateUpdate(targetDatabase, typeof(T), propertyNames, setIdentity));
        }
コード例 #5
0
 public static string CreateUpdate(DbKind targetDatabase, Type type, bool setIdentity, params string[] propertyNames)
 => This.CreateUpdate(targetDatabase, type, propertyNames, setIdentity);
コード例 #6
0
 public static string CreateUpdate(DbKind targetDatabase, Type type, params string[] propertyNames)
 => This.CreateUpdate(targetDatabase, type, propertyNames, false);
コード例 #7
0
 public static string CreateUpdate <T>(DbKind targetDatabase, params Expression <Func <T, object> >[] properties)
 => This.CreateUpdate <T>(targetDatabase, false, properties);
コード例 #8
0
 public static string CreateSelect(Type type, params string[] propertyNames)
 => This.CreateSelect(type, (IEnumerable <string>)propertyNames);
コード例 #9
0
 /// <summary>
 /// 指定された型情報から対象となるテーブルのすべてのレコードを切り捨てるクエリを生成します。
 /// </summary>
 /// <typeparam name="T">テーブルの型</typeparam>
 /// <returns>生成されたSQL</returns>
 public static string CreateTruncate <T>() => This.CreateTruncate(typeof(T));
コード例 #10
0
 /// <summary>
 /// 指定された型情報から対象となるテーブルのレコード数をカウントするクエリを生成します。
 /// </summary>
 /// <typeparam name="T">テーブルの型</typeparam>
 /// <returns>生成されたSQL</returns>
 public static string CreateCount <T>() => This.CreateCount(typeof(T));
コード例 #11
0
 /// <summary>
 /// 指定された型情報から対象となるテーブルのすべてのレコードを削除するクエリを生成します。
 /// </summary>
 /// <typeparam name="T">テーブルの型</typeparam>
 /// <returns>生成されたSQL</returns>
 public static string CreateDelete <T>() => This.CreateDelete(typeof(T));
コード例 #12
0
 /// <summary>
 /// 指定された型情報から対象となるテーブルにレコードを挿入するクエリを生成します。
 /// </summary>
 /// <typeparam name="T">テーブルの型</typeparam>
 /// <param name="targetDatabase">対象データベース</param>
 /// <param name="useSequence">シーケンスを利用するかどうか</param>
 /// <param name="setIdentity">自動採番のID列に値を設定するかどうか</param>
 /// <returns>生成されたSQL</returns>
 public static string CreateInsert <T>(DbKind targetDatabase, bool useSequence = true, bool setIdentity = false)
 => This.CreateInsert(targetDatabase, typeof(T), useSequence, setIdentity);