本文整理汇总了C#中AggregateType类的典型用法代码示例。如果您正苦于以下问题:C# AggregateType类的具体用法?C# AggregateType怎么用?C# AggregateType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AggregateType类属于命名空间,在下文中一共展示了AggregateType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Aggregate
public override object Aggregate(int[] records, AggregateType kind)
{
try
{
switch (kind)
{
case AggregateType.First:
if (records.Length > 0)
{
return _values[records[0]];
}
return null;// no data => null
case AggregateType.Count:
int count = 0;
for (int i = 0; i < records.Length; i++)
{
if (!IsNull(records[i]))
count++;
}
return count;
}
}
catch (OverflowException)
{
throw ExprException.Overflow(typeof(SqlBytes));
}
throw ExceptionBuilder.AggregateException(kind, _dataType);
}
示例2: SqlExpressionParser
private SqlExpressionParser(int indentLevel, SqlExpressionParser outerStatement,
AggregateType aggregateType)
{
this.indentLevel = indentLevel;
this.outerStatement = outerStatement;
this.aggregateType = aggregateType;
}
示例3: AggregateNode
internal AggregateNode(DataTable table, FunctionId aggregateType, string columnName, bool local, string relationName) : base(table) {
Debug.Assert(columnName != null, "Invalid parameter column name (null).");
this.aggregate = (Aggregate)(int)aggregateType;
if (aggregateType == FunctionId.Sum)
this.type = AggregateType.Sum;
else if (aggregateType == FunctionId.Avg)
this.type = AggregateType.Mean;
else if (aggregateType == FunctionId.Min)
this.type = AggregateType.Min;
else if (aggregateType == FunctionId.Max)
this.type = AggregateType.Max;
else if (aggregateType == FunctionId.Count)
this.type = AggregateType.Count;
else if (aggregateType == FunctionId.Var)
this.type = AggregateType.Var;
else if (aggregateType == FunctionId.StDev)
this.type = AggregateType.StDev;
else {
throw ExprException.UndefinedFunction(Function.FunctionName[(Int32)aggregateType]);
}
this.local = local;
this.relationName = relationName;
this.columnName = columnName;
}
示例4: AggregateExpression
public AggregateExpression(Type type, AggregateType aggregateType, Expression argument, bool distinct)
: base(MongoExpressionType.Aggregate, type)
{
AggregateType = aggregateType;
Argument = argument;
Distinct = distinct;
}
示例5: CreateAggregateAttributeDefinition
internal override AttributeDefinition CreateAggregateAttributeDefinition(AggregateType aggregateType)
{
if (aggregateType == AggregateType.Count)
return new AggregateCountAttributeDefinition(this);
return base.CreateAggregateAttributeDefinition(aggregateType);
}
示例6: Aggregate
override public Object Aggregate(int[] recordNos, AggregateType kind) {
try {
int i;
switch (kind) {
case AggregateType.Min:
int min = -1;
for (i = 0; i < recordNos.Length; i++) {
if (IsNull(recordNos[i]))
continue;
min = recordNos[i];
break;
}
if (min >= 0) {
for (i = i+1; i < recordNos.Length; i++) {
if (IsNull(recordNos[i]))
continue;
if (Compare(min, recordNos[i]) > 0) {
min = recordNos[i];
}
}
return Get(min);
}
return NullValue;
case AggregateType.Max:
int max = -1;
for (i = 0; i < recordNos.Length; i++) {
if (IsNull(recordNos[i]))
continue;
max = recordNos[i];
break;
}
if (max >= 0) {
for (i = i+1; i < recordNos.Length; i++) {
if (Compare(max, recordNos[i]) < 0) {
max = recordNos[i];
}
}
return Get(max);
}
return NullValue;
case AggregateType.Count:
int count = 0;
for (i = 0; i < recordNos.Length; i++) {
if (!IsNull(recordNos[i]))
count++;
}
return count;
}
}
catch (OverflowException) {
throw ExprException.Overflow(typeof(SqlString));
}
throw ExceptionBuilder.AggregateException(kind, DataType);
}
示例7: Aggregate
public override object Aggregate(int[] records, AggregateType kind)
{
bool hasData = false;
try
{
switch (kind)
{
case AggregateType.Min:
char min = char.MaxValue;
for (int i = 0; i < records.Length; i++)
{
int record = records[i];
if (IsNull(record))
continue;
min = (_values[record] < min) ? _values[record] : min;
hasData = true;
}
if (hasData)
{
return min;
}
return _nullValue;
case AggregateType.Max:
char max = char.MinValue;
for (int i = 0; i < records.Length; i++)
{
int record = records[i];
if (IsNull(record))
continue;
max = (_values[record] > max) ? _values[record] : max;
hasData = true;
}
if (hasData)
{
return max;
}
return _nullValue;
case AggregateType.First:
if (records.Length > 0)
{
return _values[records[0]];
}
return null;
case AggregateType.Count:
return base.Aggregate(records, kind);
}
}
catch (OverflowException)
{
throw ExprException.Overflow(typeof(char));
}
throw ExceptionBuilder.AggregateException(kind, _dataType);
}
示例8: AggregateKey
/// <summary>
/// 创建 <see cref="AggregateKey"/> 实例
/// </summary>
/// <param name="nameSpace">表示Metric命名空间</param>
/// <param name="name">表示Metric名称</param>
/// <param name="tags">表示Metric标签</param>
public AggregateKey(string nameSpace, string name, IDictionary<String, String> tags, AggregateType aggType)
{
if (nameSpace == null) throw new ArgumentNullException("nameSpace");
if (name == null) throw new ArgumentNullException("name");
this.fullName = NameHelper.GetFullName(nameSpace, name);
this.aggType = aggType;
this.keyStr = GenerateKeyString(nameSpace, name, tags);
this.hashCode = keyStr.GetHashCode();
}
示例9: Aggregate
override public Object Aggregate(int[] records, AggregateType kind) {
bool hasData = false;
try {
switch (kind) {
case AggregateType.Min:
SqlDateTime min = SqlDateTime.MaxValue;
for (int i = 0; i < records.Length; i++) {
int record = records[i];
if (IsNull(record))
continue;
if ((SqlDateTime.LessThan(values[record], min)).IsTrue)
min = values[record];
hasData = true;
}
if (hasData) {
return min;
}
return NullValue;
case AggregateType.Max:
SqlDateTime max = SqlDateTime.MinValue;
for (int i = 0; i < records.Length; i++) {
int record = records[i];
if (IsNull(record))
continue;
if ((SqlDateTime.GreaterThan(values[record], max)).IsTrue)
max = values[record];
hasData = true;
}
if (hasData) {
return max;
}
return NullValue;
case AggregateType.First:
if (records.Length > 0) {
return values[records[0]];
}
return null;// no data => null
case AggregateType.Count:
int count = 0;
for (int i = 0; i < records.Length; i++) {
if (!IsNull(records[i]))
count++;
}
return count;
}
}
catch (OverflowException) {
throw ExprException.Overflow(typeof(SqlDateTime));
}
throw ExceptionBuilder.AggregateException(kind, DataType);
}
示例10: AggregateColumn
protected AggregateColumn(AggregateType aggregate, FieldColumn column, string alias = null)
{
if (column == null)
{
throw new ArgumentNullException("column");
}
Type = aggregate;
Column = column;
Alias = alias;
}
示例11: XrmAggregate
protected XrmAggregate(string recordTypeWithAggregate, string aggregateField, string recordTypeAggregated,
string aggregatedField, AggregateType aggregateType)
{
RecordTypeWithAggregate = recordTypeWithAggregate;
AggregateField = aggregateField;
RecordTypeAggregated = recordTypeAggregated;
AggregateType = aggregateType;
AggregatedField = aggregatedField;
Filters = new ConditionExpression[] { };
AddFilter("statecode", XrmPicklists.State.Active);
LinkEntity = null;
}
示例12: Aggregate
override public Object Aggregate(int[] records, AggregateType kind) {
bool hasData = false;
try {
switch (kind) {
case AggregateType.Min:
DateTimeOffset min = DateTimeOffset.MaxValue;
for (int i = 0; i < records.Length; i++) {
int record = records[i];
if (HasValue(record)) {
min=(DateTimeOffset.Compare(values[record],min) < 0) ? values[record] : min;
hasData = true;
}
}
if (hasData) {
return min;
}
return NullValue;
case AggregateType.Max:
DateTimeOffset max = DateTimeOffset.MinValue;
for (int i = 0; i < records.Length; i++) {
int record = records[i];
if (HasValue(record)) {
max=(DateTimeOffset.Compare(values[record],max) >= 0) ? values[record] : max;
hasData = true;
}
}
if (hasData) {
return max;
}
return NullValue;
case AggregateType.First:
if (records.Length > 0) {
return values[records[0]];
}
return null;
case AggregateType.Count:
int count = 0;
for (int i = 0; i < records.Length; i++) {
if (HasValue(records[i])) {
count++;
}
}
return count;
}
}
catch (OverflowException) {
throw ExprException.Overflow(typeof(DateTimeOffset));
}
throw ExceptionBuilder.AggregateException(kind, DataType);
}
示例13: Aggregate
override public Object Aggregate(int[] records, AggregateType kind) {
bool hasData = false;
try {
switch (kind) {
case AggregateType.Min:
SqlBoolean min = true;
for (int i = 0; i < records.Length; i++) {
int record = records[i];
if (IsNull(record))
continue;
min= SqlBoolean.And(values[record], min);
hasData = true;
}
if (hasData) {
return min;
}
return NullValue;
case AggregateType.Max:
SqlBoolean max = false;
for (int i = 0; i < records.Length; i++) {
int record = records[i];
if (IsNull(record))
continue;
max= SqlBoolean.Or(values[record], max);
hasData = true;
}
if (hasData) {
return max;
}
return NullValue;
case AggregateType.First:
if (records.Length > 0) {
return values[records[0]];
}
return NullValue;
case AggregateType.Count:
int count = 0;
for (int i = 0; i < records.Length; i++) {
if (!IsNull(records[i]))
count++;
}
return count;
}
}
catch (OverflowException) {
throw ExprException.Overflow(typeof(SqlBoolean));
}
throw ExceptionBuilder.AggregateException(kind, DataType);
}
示例14: CrmAttributeXml
public CrmAttributeXml(
string name = "",
string alias = "",
AggregateType aggregate = AggregateType.None,
bool groupBy = false,
DateGroupingType dateGrouping = DateGroupingType.None
)
{
this.Name = name;
this.Alias = alias;
this.Aggregate = aggregate;
this.GroupBy = groupBy;
this.DateGrouping = dateGrouping;
}
示例15: Grouping
/// <summary>
/// Initializes a new instance of the <see cref="Grouping"/> class.
/// </summary>
/// <param name="groupOn">The property to group on.</param>
/// <param name="sortDirection">The sort direction.</param>
/// <param name="aggregateOn">The property to aggregate on.</param>
/// <param name="aggregateType">The type of aggregate to calculate.</param>
public Grouping(
PropertyDefinitionBase groupOn,
SortDirection sortDirection,
PropertyDefinitionBase aggregateOn,
AggregateType aggregateType)
: this()
{
EwsUtilities.ValidateParam(groupOn, "groupOn");
EwsUtilities.ValidateParam(aggregateOn, "aggregateOn");
this.groupOn = groupOn;
this.sortDirection = sortDirection;
this.aggregateOn = aggregateOn;
this.aggregateType = aggregateType;
}