當前位置: 首頁>>代碼示例>>C#>>正文


C# Entity.SelectKeys方法代碼示例

本文整理匯總了C#中System.Entity.SelectKeys方法的典型用法代碼示例。如果您正苦於以下問題:C# Entity.SelectKeys方法的具體用法?C# Entity.SelectKeys怎麽用?C# Entity.SelectKeys使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Entity的用法示例。


在下文中一共展示了Entity.SelectKeys方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: KeyAllQuery

        public override string KeyAllQuery(Entity entity) {
            var sql = string.Format(
                @"SELECT {0} FROM {1} ",
                string.Join(", ", entity.SelectKeys(this)),
                Enclose(entity.Name)
            );

            if (entity.Filters.Any()) {
                sql += " WHERE " + entity.Filters.ResolveExpression(TextQualifier);
            }

            sql += ";";
            return sql;

        }
開發者ID:modulexcite,項目名稱:Transformalize,代碼行數:15,代碼來源:PostgreSqlConnection.cs

示例2: KeyQuery

        public override string KeyQuery(Entity entity) {

            const string sql = @"
                SELECT {0}
                FROM [{1}].[{2}] WITH (NOLOCK)
                WHERE [{3}] <= @End
            ";

            return string.Format(
                sql,
                string.Join(", ", entity.SelectKeys(this)),
                entity.Schema,
                entity.Name,
                entity.Version.Name
            );
        }
開發者ID:modulexcite,項目名稱:Transformalize,代碼行數:16,代碼來源:SqlCeConnection.cs

示例3: KeyAllQuery

        public override string KeyAllQuery(Entity entity) {
            const string format = @"
                SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
                SELECT {0} FROM `{1}` ";

            var sql = string.Format(
                format,
                string.Join(", ", entity.SelectKeys(this)),
                entity.Name
            );

            if (entity.Filters.Any()) {
                sql += " WHERE " + entity.Filters.ResolveExpression(TextQualifier);
            }

            sql += ";COMMIT;";
            return sql;
        }
開發者ID:modulexcite,項目名稱:Transformalize,代碼行數:18,代碼來源:MySqlConnection.cs

示例4: KeyRangeQuery

        public override string KeyRangeQuery(Entity entity) {

            const string pattern = @"
                SELECT {0}
                FROM [{1}].[{2}] WITH (NOLOCK)
                WHERE [{3}] BETWEEN @Begin AND @End
                AND [{4}] IS NOT NULL
            ";

            var sql = string.Format(
                pattern,
                string.Join(", ", entity.SelectKeys(this)),
                string.IsNullOrEmpty(entity.Schema) ? DefaultSchema : entity.Schema,
                entity.Name,
                entity.Version.Name,
                entity.PrimaryKey.WithInput().First().Name
            );

            if (entity.Filters.Any()) {
                sql += " AND " + entity.Filters.ResolveExpression(TextQualifier);
            }

            return sql;
        }
開發者ID:mindis,項目名稱:Transformalize,代碼行數:24,代碼來源:SqlServerConnection.cs

示例5: KeyAllQuery

        public override string KeyAllQuery(Entity entity) {
            const string format = @"
                SELECT {0} FROM [{1}].[{2}]";

            var sql = string.Format(
                format,
                string.Join(", ", entity.SelectKeys(this)),
                string.IsNullOrEmpty(entity.Schema) ? this.DefaultSchema : entity.Schema,
                entity.Name
            );

            if (entity.NoLock) {
                sql += " WITH (NOLOCK)";
            }

            if (entity.Sample > 0m && entity.Sample < 100m && TableSample && !entity.Sampled) {
                entity.Sampled = true;
                sql += string.Format(" TABLESAMPLE ({0:##} PERCENT)", entity.Sample);
            }

            sql += " WHERE [" + entity.PrimaryKey.WithInput().First().Name + "] IS NOT NULL"; 

            if (entity.Filters.Any()) {
                sql += " AND " + entity.Filters.ResolveExpression(TextQualifier);
            }
            return sql;
        }
開發者ID:mindis,項目名稱:Transformalize,代碼行數:27,代碼來源:SqlServerConnection.cs

示例6: KeyAllQuery

        public override string KeyAllQuery(Entity entity) {
            const string sql = @"
                SELECT {0} FROM [{1}].[{2}] WITH (NOLOCK);
            ";

            return string.Format(
                sql,
                string.Join(", ", entity.SelectKeys(this)),
                entity.Schema,
                entity.Name
                );
        }
開發者ID:modulexcite,項目名稱:Transformalize,代碼行數:12,代碼來源:SqlCeConnection.cs

示例7: KeyRangeQuery

        public override string KeyRangeQuery(Entity entity) {
            var sql = string.Format(
                @"SELECT {0} FROM {1} WHERE {2} BETWEEN @Begin AND @End ",
                string.Join(", ", entity.SelectKeys(this)),
                Enclose(entity.Name),
                Enclose(entity.Version.Name)
            );

            if (entity.Filters.Any()) {
                sql += " AND " + entity.Filters.ResolveExpression(TextQualifier);
            }

            sql += ";";
            return sql;
        }
開發者ID:modulexcite,項目名稱:Transformalize,代碼行數:15,代碼來源:PostgreSqlConnection.cs


注:本文中的System.Entity.SelectKeys方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。