本文整理汇总了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;
}
示例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
);
}
示例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;
}
示例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;
}
示例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;
}
示例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
);
}
示例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;
}