當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。