当前位置: 首页>>代码示例>>C#>>正文


C# AggregateType类代码示例

本文整理汇总了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);
        }
开发者ID:dotnet,项目名称:corefx,代码行数:29,代码来源:SQLBytesStorage.cs

示例2: SqlExpressionParser

 private SqlExpressionParser(int indentLevel, SqlExpressionParser outerStatement,
                            AggregateType aggregateType)
 {
     this.indentLevel = indentLevel;
     this.outerStatement = outerStatement;
     this.aggregateType = aggregateType;
 }
开发者ID:lfont,项目名称:PetaPoco,代码行数:7,代码来源:SQLExpressionParser.cs

示例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;
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:26,代码来源:AggregateNode.cs

示例4: AggregateExpression

 public AggregateExpression(Type type, AggregateType aggregateType, Expression argument, bool distinct)
     : base(MongoExpressionType.Aggregate, type)
 {
     AggregateType = aggregateType;
     Argument = argument;
     Distinct = distinct;
 }
开发者ID:gaoninggn,项目名称:mongodb-csharp,代码行数:7,代码来源:AggregateExpression.cs

示例5: CreateAggregateAttributeDefinition

        internal override AttributeDefinition CreateAggregateAttributeDefinition(AggregateType aggregateType)
        {
            if (aggregateType == AggregateType.Count)
                return new AggregateCountAttributeDefinition(this);

            return base.CreateAggregateAttributeDefinition(aggregateType);
        }
开发者ID:donald-hanson,项目名称:V1Antlr,代码行数:7,代码来源:MultiRelationAttributeDefinition.cs

示例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);
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:58,代码来源:SQLStringStorage.cs

示例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);
        }
开发者ID:dotnet,项目名称:corefx,代码行数:56,代码来源:CharStorage.cs

示例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();
        }
开发者ID:felix-tien,项目名称:TechLab,代码行数:16,代码来源:AggregateKey.cs

示例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);
        }
开发者ID:uQr,项目名称:referencesource,代码行数:54,代码来源:SQLDateTimeStorage.cs

示例10: AggregateColumn

        protected AggregateColumn(AggregateType aggregate, FieldColumn column, string alias = null)
        {
            if (column == null)
            {
                throw new ArgumentNullException("column");
            }

            Type = aggregate;
            Column = column;
            Alias = alias;
        }
开发者ID:candoumbe,项目名称:Queries,代码行数:11,代码来源:AggregateColumn.cs

示例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;
 }
开发者ID:josephmcmac,项目名称:JosephM.Xrm.Settings,代码行数:12,代码来源:XrmAggregate.cs

示例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);
        }
开发者ID:uQr,项目名称:referencesource,代码行数:53,代码来源:DateTimeOffsetStorage.cs

示例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);
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:52,代码来源:SQlBooleanStorage.cs

示例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;
 }
开发者ID:poloagustin,项目名称:poloagustin-bsv,代码行数:14,代码来源:CrmAttributeXml.cs

示例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;
        }
开发者ID:Pravinmprajapati,项目名称:ews-managed-api,代码行数:22,代码来源:Grouping.cs


注:本文中的AggregateType类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。