当前位置: 首页>>代码示例>>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;未经允许,请勿转载。