Show / Hide Table of Contents

    IGroupingGetter Interface

    .NET Standard 2.x

    Represents the getter for a group. Used in conjunction with the grouping function of the DataStore.

    When the IsGroup property is true, it is used to get a group of data; when the IsGroup property is false, it is used to get data of a certain row.

    Namespace: DWNet.Data

    Assembly: DWNet.Data.dll

    Syntax

    public interface IGroupingGetter;
    

    Properties

    Name Return Type Description
    IsGroup bool Whether the current IGroupingGetter object represents a group.
    Key object When the IsGroup property is true, represents the common key of the objects in the current group.
    RowId int When the IsGroup property is false, gets the ID of the row in the DataStore corresponding to the model object.
    Value object When IsGroup is false, gets a row of data.

    Methods

    Name Return Type Description
    GetEnumerator() IEnumerator<IGroupingGetter> When the IsGroup property is true, returns an enumerator that iterates through the group.
    GetItem(short column, bool isOriginalValue = false) object When the IsGroup property is false, gets the value of the specified column (by the column number).
    GetItem(string column, bool isOriginalValue = false) object When the IsGroup property is false, gets the value of the specified column (by the column name).
    GetItem<TValue>(short column, bool isOriginalValue = false) TValue When the IsGroup property is false, gets the value of the specified column (by the column number) and converts this value to the specified data type.
    GetItem<TValue>(string column, bool isOriginalValue = false) TValue When the IsGroup property is false, gets the value of the specified column (by the column name) and converts this value to the specified data type.
    GetItemBoolean(short column, bool isOriginalValue = false) bool? When the IsGroup property is false, gets the value of the specified column (by the column number) and converts this value to the System.Nullable<System.Boolean> data type.
    GetItemBoolean(string column, bool isOriginalValue = false) bool? When the IsGroup property is false, gets the value of the specified column (by the column name) and converts this value to the System.Nullable<System.Boolean> data type.
    GetItemDate(short column, bool isOriginalValue = false) DateTime? When the IsGroup property is false, gets the value of the specified column (by the column number) and converts this value to the System.Nullable<System.DateTime> data type.
    GetItemDate(string column, bool isOriginalValue = false) DateTime? When the IsGroup property is false, gets the value of the specified column (by the column name) and converts this value to the System.Nullable<System.DateTime> data type.
    GetItemDateTime(short column, bool isOriginalValue = false) DateTime? When the IsGroup property is false, gets the value of the specified column (by the column number) and converts this value to the System.Nullable<System.DateTime> data type.
    GetItemDateTime(string column, bool isOriginalValue = false) DateTime? When the IsGroup property is false, gets the value of the specified column (by the column name) and converts this value to the System.Nullable<System.DateTime> data type.
    GetItemDecimal(short column, bool isOriginalValue = false) decimal? When the IsGroup property is false, gets the value of the specified column (by the column number) and converts this value to the System.Nullable<System.Decimal> data type.
    GetItemDecimal(string column, bool isOriginalValue = false) decimal? When the IsGroup property is false, gets the value of the specified column (by the column name) and converts this value to the System.Nullable<System.Decimal> data type.
    GetItemNumber(short column, bool isOriginalValue = false) double? When the IsGroup property is false, gets the value of the specified column (by the column number) and converts this value to the System.Nullable<System.Double> data type.
    GetItemNumber(string column, bool isOriginalValue = false) double? When the IsGroup property is false, gets the value of the specified column (by the column name) and converts this value to the System.Nullable<System.Double> data type.
    GetItemString(short column, bool isOriginalValue = false) string When the IsGroup property is false, gets the value of the specified column (by the column number) and converts this value to the System.String data type.
    GetItemString(string column, bool isOriginalValue = false) string When the IsGroup property is false, gets the value of the specified column (by the column name) and converts this value to the System.String data type.
    GetItemTime(short column, bool isOriginalValue = false) TimeSpan? When the IsGroup property is false, gets the value of the specified column (by the column number) and converts this value to the System.Nullable<System.TimeSpan> data type.
    GetItemTime(string column, bool isOriginalValue = false) TimeSpan? When the IsGroup property is false, gets the value of the specified column (by the column name) and converts this value to the System.Nullable<System.TimeSpan> data type.

    Examples

    The following code example creates an instance of GroupingGetter.

    using DWNet.Data;
    using System;
    
    namespace Appeon.ApiDoc.IGroupingGetterExamples
    {
        public class IGroupingGetterExample
        {
            private readonly SchoolContext _context;
    
            public IGroupingGetterExample(SchoolContext context)
            {
                _context = context;
            }
    
            public void Example()
            {
                // Creates a datastore object
                var course = new DataStore("d_department_course", _context);
    
                course.Retrieve();
                
                var deptGroups = course.GroupBy();
    
                // Gets the grouped data
                foreach(var departGroup in deptGroups)
                {
                    Console.WriteLine("Group key = {0}", departGroup.Key);
    
                    // Shows the data in each group in a loop
                    foreach (var getter in departGroup)
                    {
                        Console.WriteLine(" getter key = {0}", getter.Key); 
                    }  
                }
    
                /*This code produces the following output:
                
                Group key = 1
                 getter key = 1050
                 getter key = 1061
                Group key = 2
                 getter key = 2021
                 getter key = 2030
                 getter key = 2042
                Group key = 4
                 getter key = 4022
                 getter key = 4041
                 getter key = 4061
                Group key = 7
                 getter key = 1045
                
                */
            }
        }
    }
    

    Example Refer To

    Model Class: D_Department_Course
    DataWindow File: d_department_course

    Back to top Generated by Appeon