• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# AggregateType类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中AggregateType的典型用法代码示例。如果您正苦于以下问题:C# AggregateType类的具体用法?C# AggregateType怎么用?C# AggregateType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



AggregateType类属于命名空间,在下文中一共展示了AggregateType类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16: Aggregate

        override public Object Aggregate(int[] records, AggregateType kind) {
            bool hasData = false;
            try {
                switch (kind) {
                    case AggregateType.Min:
                        Boolean min = true;
                        for (int i = 0; i < records.Length; i++) {
                            int record = records[i];
                            if (IsNull(record))
                                continue;
                            min=values[record] && min;
                            hasData = true;
                        }
                        if (hasData) {
                            return min;
                        }
                        return NullValue;

                    case AggregateType.Max:
                        Boolean max = false;
                        for (int i = 0; i < records.Length; i++) {
                            int record = records[i];
                            if (IsNull(record))
                                continue;
                            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(Boolean));
            }
            throw ExceptionBuilder.AggregateException(kind, DataType);
        }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:48,代码来源:BooleanStorage.cs


示例17: ChecksumAgg

        /// <summary>
        /// Returns the checksum of the values in a group. Null values are ignored. Can be followed by the OVER clause.
        /// </summary>
        /// <param name="expression"></param>
        /// <param name="aggType"></param>
        /// <param name="expressionAlias"></param>
        /// <returns></returns>
        public static string ChecksumAgg(string expression, AggregateType aggType = AggregateType.Default, string expressionAlias = null)
        {
            StringBuilder builder = new StringBuilder(expression.Length + 24);

            builder.Append("CHECKSUM_AGG(");

            AppendAggregateType(builder, aggType);

            builder.Append(InternalConstants.CharSpace);
            builder.Append(expression);
            builder.Append(")");

            Aliases.AppendAlias(builder, expressionAlias);

            return builder.ToString();
        }
开发者ID:tjb042,项目名称:TowerSQL,代码行数:23,代码来源:Aggregate.cs


示例18: Aggregate

        public override object Aggregate(int[] records, AggregateType kind)
        {
            try
            {
                int num;
                int num2;
                switch (kind)
                {
                    case AggregateType.First:
                        if (records.Length <= 0)
                        {
                            return null;
                        }
                        return this.values[records[0]];

                    case AggregateType.Count:
                        num2 = 0;
                        num = 0;
                        goto Label_0044;

                    default:
                        goto Label_0068;
                }
            Label_0031:
                if (!this.IsNull(records[num]))
                {
                    num2++;
                }
                num++;
            Label_0044:
                if (num < records.Length)
                {
                    goto Label_0031;
                }
                return num2;
            }
            catch (OverflowException)
            {
                throw ExprException.Overflow(typeof(SqlXml));
            }
        Label_0068:
            throw ExceptionBuilder.AggregateException(kind, base.DataType);
        }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:43,代码来源:SqlXmlStorage.cs


示例19: GetValue

 public static string GetValue(AggregateType aggregateType)
 {
     switch (aggregateType)
     {
         case AggregateType.Count:
             return "count";
         case AggregateType.CountColumn:
             return "countcolumn";
         case AggregateType.Sum:
             return "sum";
         case AggregateType.Avg:
             return "avg";
         case AggregateType.Min:
             return "min";
         case AggregateType.Max:
             return "max";
         default:
             return string.Empty;
     }
 }
开发者ID:poloagustin,项目名称:poloagustin-bsv,代码行数:20,代码来源:AggregateTypeHelper.cs


示例20: BaseUnionIntersectionCommand

 public BaseUnionIntersectionCommand(string key, IEnumerable<String> keys,
     IEnumerable<Double> weights, AggregateType aggregateType) 
     : base(key)
 {
     if (keys == null)
         throw new ArgumentNullException("keys");
     _keys = new List<String>(keys);
     if (_keys.Count < 2)
         throw new CommandArgumentException("keys", "At least 2 keys must be specified");
     if (weights != null)
     {
         _weights = new List<Double>(_weights);
         if (_weights.Count != _keys.Count)
         {
             throw new CommandArgumentException("weights",
                 "The number of weights must match the number of keys.");
         }
     }
     _aggregate = aggregateType;
 }
开发者ID:vebin,项目名称:Guanima.Redis,代码行数:20,代码来源:BaseUnionIntersectionCommand.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# AgilityPackHelper类代码示例发布时间:2022-05-24
下一篇:
C# AggregateException类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap