Show / Hide Table of Contents

    DataStore Class

    .NET Standard 2.x

    The DataStore class provides non-generic .NET DataStore which has almost the same set of APIs, data buffers, and approach to transaction management as PowerBuilder. Unlike generic .NET DataStore, non-generic .NET DataStore does not require developers to know the .NET technology and what "generic" means, therefore, PowerBuilder developers can easily start from this DataStore class.

    Namespace: DWNet.Data

    Assembly: DWNet.Data.dll

    Syntax

    public class DataStore : DataStoreBase, IDataStore;
    

    Constructors

    Name Description
    DataStore() Initializes a new instance of the DataStore class.
    DataStore(string dataObject) Initializes a new instance of the DataStore class using a DataWindow object.
    DataStore(string dataObject, DataContext context) Initializes a new instance of the DataStore class using a DataWindow object and a DataContext object.
    DataStore(string dataObject, IEnumerable<IModelEntry> modelEntries) Initializes a new instance of the DataStore class using a DataWindow object and a sequence of IModelEntry objects.
    DataStore(Type modelType) Initializes a new instance of the DataStore class using a Type object.
    DataStore(Type modelType, DataContext context) Initializes a new instance of the DataStore class using a Type object and a DataContext object.

    Properties

    Name Return Type Description
    Current Object Gets the reference to the row at the current position of the enumerator.
    DataObject string Specifies the name of the DataWindow object associated with the DataStore.
    DeletedCount int Gets the total number of rows that are marked for deletion in the database.
    FilteredCount int Gets the number of rows that have been filtered by the current filter criteria.
    Index int Gets the index of the current row when traversing DataStore.
    ModifiedCount int Gets the number of rows that have been modified but not updated in the DataStore.
    Object IDataObject Used to directly manipulate the object within a DataStore object from a script. These objects can be, for example, columns or text objects.
    RowCount int Gets the number of rows in the primary buffer of DataStore.
    TotalCount int Gets the total number of rows in all buffers of the DataStore.

    Methods

    Name Return Type Description
    Add<TModel>(TModel item) void Appends a TModel instance as a row to the end of the primary buffer in the DataStore.
    AddRow() int Appends a row to the end of the primary buffer in the DataStore and returns the zero-based index. If any columns have default values, the row is initialized with these values.
    AddRow<TModel>(TModel model) int Appends a row to the end of the primary buffer in the DataStore and returns the zero-based index. TModel must match with the DataObject property of the DataStore.
    AddRow<TModel>(IEnumerable<TModel> list) int Appends a collection of TModel type as row(s) to the end of the primary buffer in the DataStore and returns the zero-based index of the first row added. TModel must match with the DataObject property of the DataStore.
    AsEnumerable<TModel>(DwBuffer bufferType = DwBuffer.Primary) IEnumerable<TModel> Converts the data in the specified buffer to an IEnumerable<TModel> object. Defaults to the primary buffer if bufferType is not specified.
    Avg<TModel>(Func<TModel, decimal> selector) decimal Computes the average of a sequence of System.Decimal values that are obtained by invoking a transform function on each row of the primary buffer in the DataStore.
    Avg<TModel>(Func<TModel, decimal> selector, Predicate<TModel> predicate) decimal Computes the average of a sequence of System.Decimal values that are obtained by invoking a transform function on each row of the primary buffer filtered base on a predicate in the DataStore.
    Contains(TModel item) bool Determines whether a row exists in the primary buffer of the DataStore.
    CopyTo<TModel>(TModel[] array, int arrayIndex) void Copies all rows from the primary buffer of the DataStore to a compatible one-dimensional System.Array, starting at a particular System.Array index.
    Count<TModel>(Predicate<TModel> predicate) int Returns a number that represents how many rows in the primary buffer of DataStore satisfy a condition.
    Create(IDwMeta dwMeta) IDataStore Creates a DataStore object according to the IDwMeta object.
    Create(IDwMeta dwMeta, DataContext context) IDataStore Creates a DataStore object according to the IDwMeta object and specifies the DataContext for the DataStore.
    DeleteRow(int row) bool Deletes the specified row by the zero-based index from the primary buffer of the DataStore. The deleted row will be moved to the delete buffer of the DataStore.
    DeleteRow<TModel>(TModel model) bool Deletes the specified row according to the specified TModel from the primary buffer of the DataStore. The deleted row will be moved to the delete buffer of the DataStore.
    DeleteRow<TModel>(Predicate<TModel> predicate) bool Deletes the row(s) based on a predicate from the primary buffer of the DataStore. The deleted row(s) will be moved to the delete buffer of the DataStore.
    Dispose() void Performs application-defined tasks associated with freeing, releasing, or resetting the unmanaged resource. Inherited from IDisposable.
    Evaluate<TValue>(string expression) TValue Calculates the result of the specified DataWindow expression using the data in the primary buffer of the DataStore.
    Evaluate<TValue>(string expression, int row) TValue Calculates the specified DataWindow expression by the specified row (zero-based index) in the primary buffer of the DataStore, and returns the result value.
    Exists<TModel>(Predicate<TModel> predicate) bool Determines whether there is a row in the primary buffer of the DataStore that meets the specified condition.
    ExportJson(MappingMethod mappingMethod) string Exports data from the DataStore primary buffer to a DataWindow JSON string.
    ExportJson(bool changeOnly, MappingMethod mappingMethod) string Exports all rows or only the changed rows from the DataStore to a DataWindow JSON string.
    ExportJson(DwBuffer dwbuffer, bool changedOnly, MappingMethod mappingMethod) string Exports all rows or only the changed rows from all or specified buffers to a DataWindow JSON string.
    ExportJson(bool primaryData, bool filterData, bool deleteData, bool dwcdata, MappingMethod mappingMethod) string Exports data from the specified buffer(s) and/or DataWindowChild to a DataWindow JSON string.
    ExportJson(DwBuffer dwbuffer, MappingMethod mappingMethod) string Exports data from the specified buffer to a DataWindow JSON string.
    ExportJson(DwBuffer dwbuffer, int startRow, MappingMethod mappingMethod) string Exports the rows (from the specified starting position to the end) from the specified buffer to a DataWindow JSON string.
    ExportJson(DwBuffer dwbuffer, int startRow, int endRow, MappingMethod mappingMethod) string Exports the rows (from the specified starting position to the ending position) from the specified buffer to a DataWindow JSON string.
    ExportJson(DwBuffer dwbuffer, int startRow, int endRow, short startColumn, MappingMethod mappingMethod) string Exports the rows (from the specified starting position to the ending position) and the columns (from the specified starting position to the end) from the specified buffer to a DataWindow JSON string.
    ExportJson(DwBuffer dwbuffer, int startRow, int endRow, short startColumn, short endColumn, MappingMethod mappingMethod) string Exports the rows (from the specified starting position to the ending position) and the columns (from the specified starting position to the ending position) from the specified buffer to a DataWindow JSON string.
    ExportPlainJson() string Exports data from the DataStore primary buffer to a plain-format JSON string.
    ExportPlainJson(bool changeOnly) string Exports all rows or only the changed rows from the DataStore to a plain-format JSON string.
    ExportPlainJson(DwBuffer dwbuffer, bool changedOnly) string Exports all rows or only the changed rows from all or specified buffers to a plain-format or DataWindow JSON string.
    ExportPlainJson(bool primaryData, bool filterData, bool deleteData, bool dwcdata) string Exports data from the specified buffer(s) and/or DataWindowChild to a plain-format JSON string.
    ExportPlainJson(DwBuffer dwbuffer) string Exports data from the specified buffer to a plain-format JSON string.
    ExportPlainJson(DwBuffer dwbuffer, int startRow) string Exports the rows (from the specified starting position to the end) from the specified buffer to a plain-format JSON string.
    ExportPlainJson(DwBuffer dwbuffer, int startRow, int endRow) string Exports the rows (from the specified starting position to the ending position) from the specified buffer to a plain-format JSON string.
    ExportPlainJson(DwBuffer dwbuffer, int startRow, int endRow, int startColumn) string Exports the rows (from the specified starting position to the ending position) and the columns (from the specified starting position to the end) from the specified buffer to a plain-format JSON string.
    ExportPlainJson(DwBuffer dwbuffer, int startRow, int endRow, int startColumn, int endColumn) string Exports the rows (from the specified starting position to the ending position) and the columns (from the specified starting position to the ending position) from the specified buffer to a plain-format JSON string.
    ExportString(bool colheading = true) string Exports all of the data rows from the primary buffer of the DataStore to a string. The column name is exported by default.
    ExportString(int startRow, int endRow, bool colheading = true) string Exports the rows (from the specified starting position to the ending position) from the primary buffer of the DataStore to a string. The column name is exported by default.
    ExportString(int startRow, int endRow, int startColumn, int endColumn, bool colheading = true) string Exports the rows (from the specified starting position to the ending position) and the columns (from the specified starting position to the ending position) from the primary buffer of the DataStore to a string. The column name is exported by default.
    Filter(string format) bool Filters rows by the current filter criteria. Rows that do not meet the filter criteria are moved to the filter buffer. The filter criteria can be re-set using the format parameter.
    Filter<TModel>(Func<TModel, bool> predicate) bool Filters rows by the filter criteria specified by Func<TModel>. Rows that do not meet the filter criteria are moved to the filter buffer.
    FilterEx<TModel>(Expression<Func<TModel, bool>> expression) bool Generic method. Filters rows by the filter criteria specified by Expression<Func<TModel>>. Rows that do not meet the filter criteria are moved to the filter buffer.
    Find<TModel>(string expression, int start, int end, DwBuffer bufferType = DwBuffer.Primary) TModel Generic method. Finds the next zero-based row in the specified buffer of the DataStore in which data meets the condition specified by the expression.
    Find<TModel>(Predicate<TModel> predicate, int start, int end, DwBuffer bufferType = DwBuffer.Primary) TModel Generic method. Finds the next row in the DataStore in which data meets the criteria defined by Predicate.
    Find<TModel>(string expression, DwBuffer bufferType = DwBuffer.Primary) TModel Generic method. Finds the next zero-based row in the specified buffer of the DataStore in which data meets the condition specified by the expression.
    Find<TModel>(Predicate<TModel> predicate, DwBuffer bufferType = DwBuffer.Primary) TModel Generic method. Finds the next row in the DataStore in which data meets the criteria defined by Predicate.
    FindIndex(string expression, int start, int end, DwBuffer bufferType = DwBuffer.Primary) int Returns the zero-based index of the next row in the specified buffer of the DataStore in which data meets the condition specified by the expression.
    FindIndex<TModel>(Predicate<TModel> predicate, int start, int end, DwBuffer bufferType = DwBuffer.Primary) int Generic method. Returns the index of the next row in the DataStore in which data meets the criteria defined by Predicate.
    FindIndex(string expression, DwBuffer bufferType = DwBuffer.Primary) int Returns the zero-based index of the next row in the specified buffer of the DataStore in which data meets the condition specified by the expression.
    FindIndex<TModel>(Predicate<TModel> predicate, DwBuffer bufferType = DwBuffer.Primary) int Generic method. Returns the index of the next row in the DataStore in which data meets the criteria defined by Predicate.
    FirstOrDefault<TModel>() TModel Generic method. Returns the first data row of the DataStore. If no data row is found, returns null.
    FirstOrDefault<TModel>(Predicate<TModel> predicate) TModel Generic method. Returns the first data row of the DataStore that meets the criteria specified by Predicate<TModel>. If no data row is found, returns null.
    GetChild(string name) IDataStore Provides a reference to the child DataWindow, which you can use to manipulate that DataStore.
    GetChild(string name, out IDataStore child) bool Provides a reference to the DataWindowChild, which you can use to manipulate that DataStore.
    GetEnumerator() IEnumerator Obtains the enumerator that can be used to iterate through the DataStore. Inherited from IEnumerator<T>.
    GetItem<TValue>(int row, short column, DwBuffer bufferType = DwBuffer.Primary, bool isOriginalValue = false) TValue Generic method. Gets the data for the specified row and column from the specified buffer of the DataStore.
    GetItem<TValue>(int row, string column, DwBuffer bufferType = DwBuffer.Primary, bool isOriginalValue = false) TValue Generic method. Gets the data for the specified row and column from the specified buffer of the DataStore.
    GetItem(int row, short column, DwBuffer bufferType = DwBuffer.Primary, bool isOriginalValue = false) object Gets the data for the specified row and column from the specified buffer of the DataStore.
    GetItem(int row, string column, DwBuffer bufferType = DwBuffer.Primary, bool isOriginalValue = false) object Gets the data for the specified row and column from the specified buffer of the DataStore.
    GetItemBoolean(int row, short column, DwBuffer bufferType = DwBuffer.Primary, bool isOriginalValue = false) bool? Gets data whose type is Boolean for the specified row and column (specified by column number) from the specified buffer of the DataStore.
    GetItemBoolean(int row, string column, DwBuffer bufferType = DwBuffer.Primary, bool isOriginalValue = false) bool? Gets data whose type is Boolean for the specified row and column (specified by column name) from the specified buffer of the DataStore.
    GetItemDate(int row, short column, DwBuffer bufferType = DwBuffer.Primary, bool isOriginalValue = false) DateTime? Gets data whose type is DateTime for the specified row and column from the specified buffer of the DataStore.
    GetItemDate(int row, string column, DwBuffer bufferType = DwBuffer.Primary, bool isOriginalValue = false) DateTime? Gets data whose type is DateTime for the specified row and column from the specified buffer of the DataStore.
    GetItemDateTime(int row, short column, DwBuffer bufferType = DwBuffer.Primary, bool isOriginalValue = false) DateTime? Gets data whose type is DateTime for the specified row and column from the specified buffer of the DataStore.
    GetItemDateTime(int row, string column, DwBuffer bufferType = DwBuffer.Primary, bool isOriginalValue = false) DateTime? Gets data whose type is DateTime for the specified row and column from the specified buffer of the DataStore.
    GetItemDecimal(int row, short column, DwBuffer bufferType = DwBuffer.Primary, bool isOriginalValue = false) decimal? Gets data whose type is Decimal for the specified row and column from the specified buffer of the DataStore.
    GetItemDecimal(int row, string column, DwBuffer bufferType = DwBuffer.Primary, bool isOriginalValue = false) decimal? Gets data whose type is Decimal for the specified row and column from the specified buffer of the DataStore.
    GetItemNumber(int row, short column, DwBuffer bufferType = DwBuffer.Primary, bool isOriginalValue = false) double? Gets data whose type is Double for the specified row and column from the specified buffer of the DataStore.
    GetItemNumber(int row, string column, DwBuffer bufferType = DwBuffer.Primary, bool isOriginalValue = false) double? Gets data whose type is Double for the specified row and column from the specified buffer of the DataStore.
    GetItemStatus(int row, short column, DwBuffer bufferType = DwBuffer.Primary) PropertyState Reports the modification status of a column (specified by column number) within a row in the specified buffer.
    GetItemStatus(int row, string column, DwBuffer bufferType = DwBuffer.Primary) PropertyState Gets the modification status of a column (specified by column name) within a row in the specified buffer.
    GetItemStatus<TModel>(int row, Expression<Func<TModel, object>> selector, DwBuffer bufferType = DwBuffer.Primary) PropertyState Gets the modification status of a column (specified by an expression) within a row in the specified buffer.
    GetItemString(int row, short column, DwBuffer bufferType = DwBuffer.Primary, bool isOriginalValue = false) string Gets data whose type is String for the specified row and column from the specified buffer of the DataStore.
    GetItemString(int row, string column, DwBuffer bufferType = DwBuffer.Primary, bool isOriginalValue = false) string Gets data whose type is String for the specified row and column from the specified buffer of the DataStore.
    GetItemTime(int row, short column, DwBuffer bufferType = DwBuffer.Primary, bool isOriginalValue = false) TimeSpan? Gets data whose type is TimeSpan for the specified row and column from the specified buffer of the DataStore.
    GetItemTime(int row, string column, DwBuffer bufferType = DwBuffer.Primary, bool isOriginalValue = false) TimeSpan? Gets data whose type is TimeSpan for the specified row and column from the specified buffer of the DataStore.
    GetModel<TModel>(int row) TModel Obtains the data of the specified row.
    GetModel<TModel>(int row, bool calcCompute) TModel Obtains the data of the specified row.
    GetModelByRowId<TModel>(int rowid) TModel Gets the TModel instance of a row according to the specified unique row identifier associated with that row.
    GetModelByRowId<TModel>(int rowid, bool calcCompute) TModel Gets the TModel object of a row according to the unique row identifier associated with that row.
    GetReport(int row, string name) IDataStore Gets the report from the composite or nested report.
    GetRowFromRowId(int rowid, DwBuffer bufferType = DwBuffer.Primary) int Gets the row number of a row in the DataStore from the unique row identifier associated with that row.
    GetRowIdFromRow(int rownumber, DwBuffer bufferType = DwBuffer.Primary) int Gets the unique row identifier of a row in the DataStore from the row number associated with that row.
    GetRowStatus(int row, DwBuffer bufferType = DwBuffer.Primary) ModelState Gets the modification status of a row.
    GetSqlSelect() string Gets the SQL SELECT statement associated with the DataStore.
    GetValues(short column, DwBuffer bufferType = DwBuffer.Primary) IEnumerable<object> Obtains a collection of values of the specified column (by zero-based column number), from the specified buffer in the DataStore.
    GetValues(string column, DwBuffer bufferType = DwBuffer.Primary) IEnumerable<object> Obtains a collection of values of the specified column (by column name), from the specified buffer in the DataStore.
    GroupBy() IEnumerable<IGrouping<object, IGroupingGetter>> Groups all rows of the primary buffer by the current grouping criteria of DataStore.
    GroupBy<TModel>() IEnumerable<IGrouping<object, IGroupingGetter<TModel>>> Generic method. Groups all rows of the primary buffer by the current grouping criteria of DataStore.
    GroupBy(int level, string sortKey = null) IEnumerable<IGrouping<object, IModelGetter>> Groups rows of the primary buffer by the specified zero-based level of grouping criteria of DataStore.
    GroupBy<TModel>(int level, string sortKey = null) IEnumerable<IGrouping<object, TModel>> Generic method. Groups rows of the primary buffer by the specified zero-based level of grouping criteria of DataStore.
    GroupBy(string selectorKey, string sortKey = null) IEnumerable<IGrouping<object, IModelGetter>> Groups rows of the primary buffer by the custom grouping criteria.
    GroupBy<TModel>(string selectorKey, string sortKey = null) IEnumerable<IGrouping<object, TModel>> Generic method. Groups rows of the primary buffer by the custom grouping criteria.
    GroupBy<TModel>(Func<TModel, object> selectorKey) IEnumerable<IGrouping<object, TModel>> Generic method. Groups rows of the primary buffer by the custom grouping criteria defined by Func<TModel, object>.
    ImportEntry(IModelEntry entry) int Imports an IModelEntry object, which contains data and state, to the end of the DataStore.
    ImportEntry(IEnumerable<IModelEntry> entries) int Imports a sequence of IModelEntry objects, which contain data and state, to the end of the DataStore.
    ImportJson(string text) int Inserts data from a JSON string into the DataStore.
    ImportJson(string text, DwBuffer dwbuffer) int Inserts data from a JSON string into the specified buffer of DataStore.
    ImportJson(string text, DwBuffer dwbuffer, int startRow) int Inserts data from a JSON string into the specified buffer of DataStore. You can specify the starting position in the JSON array.
    ImportJson(string text, DwBuffer dwbuffer, int startRow, int endRow) int Inserts data from a JSON string into the specified buffer of DataStore. You can specify the starting and ending position in the JSON array.
    ImportJson(string text, DwBuffer dwbuffer, int startRow, int endRow, int startColumn) int Inserts data from a JSON string into the specified buffer of DataStore. You can specify the starting and ending positions in the JSON array, and you can specify the number of the first key value in the JSON object to be imported.
    ImportJson(string text, DwBuffer dwbuffer, int startRow, int endRow, int startColumn, int endColumn) int Inserts data from a JSON string into the specified buffer of DataStore. You can specify the starting and ending positions in the JSON array, and you can specify the number of the first key value and the number of the last key value in the JSON object to be imported.
    ImportJson(string text, DwBuffer dwbuffer, int startRow, int endRow, int startColumn, int endColumn, int dwStartColumn) int Inserts data from a JSON string into the specified buffer of DataStore. You can specify the starting and ending positions in the JSON array, and specify the number of the first key value and the number of the last key value in the JSON object to be imported. You can also specify the number of the first column in the DataStore that should receive data.
    ImportJsonByKey(string text) int Inserts data from a JSON string into the DataStore according to the key name of the JSON item.
    ImportJsonByKey(string text, DwBuffer dwbuffer) int Inserts data from a JSON string into the specified buffer of DataStore according to the key name of the JSON item.
    ImportJsonByKey(string text, DwBuffer dwbuffer, int startRow) int Inserts data from a JSON string into the specified buffer of DataStore according to the key name of the JSON item. You can specify the starting position in the JSON array.
    ImportJsonByKey(string text, DwBuffer dwbuffer, int startRow, int endRow) int Inserts data from a JSON string into the specified buffer of DataStore according to the key name of the JSON item. You can specify the starting and ending positions in the JSON array.
    ImportString(string text) int Inserts the tab-separated data from a string into the DataStore.
    ImportString(string text, int startRow) int Inserts the tab-separated data from a string into the DataStore. You can specify which row in the string is the first row to import.
    ImportString(string text, int startRow, int endRow) int Inserts the tab-separated data from a string into the DataStore. You can specify the starting and ending rows in the string to import.
    ImportString(string text, int startRow, int endRow, int startColumn) int Inserts the tab-separated data from a string into the DataStore. You can specify the starting and ending rows and the starting column in the string to import.
    ImportString(string text, int startRow, int endRow, int startColumn, int endColumn) int Inserts the tab-separated data from a string into the DataStore. You can specify the starting and ending rows and columns in the string to import.
    ImportString(string text, int startRow, int endRow, int startColumn, int endColumn, int dwStartColumn) int Inserts the tab-separated data from a string into the DataStore. You can specify the starting and ending rows and columns in the string to import. You can also specify which column in the DataStore is the first column to receive data.
    IndexOf<TModel>(TModel item) int Determines the index of a specific model instance in the primary buffer of DataStore.
    Insert<TModel>(int index, TModel item) void Inserts data at the specified index in the primary buffer of the DataStore.
    InsertRow(int row) int Inserts a row to the specified position in the DataStore. If any columns have default values, the row is initialized with these values.
    InsertRow<TModel>(int row, TModel model) int Inserts a TModel instance as a row to the specified position in the primary buffer of the DataStore.
    LastOrDefault<TModel>() TModel Generic method. Returns the last data row of the DataStore. If no data row is found, returns null.
    LastOrDefault<TModel>(Predicate<TModel> predicate) TModel Generic method. Returns the last data row of the DataStore that meets the criteria specified by Predicate<TModel>. If no data row is found, returns null.
    Max<TModel, TResult>(Func<TModel, TResult> selector) TResult Invokes a transform function on each row of the primary buffer in the DataStore and returns the maximum result value.
    Max<Tmodel, TResult>(Func<Tmodel, TResult> selector, Predicate<Tmodel> predicate) TResult Invokes a transform function on each row (that satisfies the condition specified by Predicate<TModel>) in the primary buffer of the DataStore and returns the maximum result value.
    Min<TModel, TResult>(Func<TModel, TResult> selector) TResult Invokes a transform function on each row of the primary buffer in the DataStore and returns the minimum result value.
    Min<TModel, TResult>(Func<TModel, TResult> selector, Predicate<TModel> predicate) TResult Invokes a transform function on each row (that satisfies the condition specified by Predicate<TModel>) in the primary buffer of the DataStore and returns the minimum result value.
    MoveNext() bool Advances the enumerator to the next row of the primary buffer in DataStore.
    OnRetrieveEnd(object sender, DwRetrieveEventArgs e) void This method is called when the DataStore completes the data retrieval. It triggers the RetrieveEnd event by default, and it can be overridden in a child class of the DataStore.
    OnRetrieveStart(object sender, DwRetrieveEventArgs e) void This method is called before the DataStore starts the data retrieval. It triggers the RetrieveStart event by default, and it can be overridden in a child class of the DataStore.
    OnRowDeleted(object sender, DwRowChangeEventArgs e) void This method is called after a row in the DataStore has been deleted. It triggers the RowDeleted event by default, and it can be overridden in a child class of the DataStore.
    OnRowDeleting(object sender, DwRowChangeEventArgs e) void This method is called before a row in the DataStore is about to be deleted. It triggers the RowDeleting event by default, and it can be overridden in a child class of the DataStore.
    OnUpdateEnd(object sender, DwUpdateEventArgs e) void This method is called after DataStore has finished updating the data. It triggers the UpdateEnd event by default, and it can be overridden in a child class of the DataStore.
    OnUpdateStart(object sender, DwUpdateEventArgs e) void This method is called before the DataStore updates the data. It triggers the UpdateStart event by default, and it can be overridden in a child class of the DataStore.
    OrderBy<TModel>(Func<TModel, object> keySelector) IOrderable<TModel> Sorts the rows of the primary buffer in the DataStore in ascending order according to a key.
    OrderByDescending<TModel>(Func<TModel, object> keySelector) IOrderable<TModel> Sorts the rows of the primary buffer in the DataStore in descending order according to a key.
    Remove<TModel>(TModel item) bool Removes the specified row from the primary buffer of the DataStore.
    RemoveAt(int index) void Removes the row according to the specified index from the primary buffer of the DataStore. The index is the same as the zero-based row number.
    ReselectRow(int row) int Accesses the database to retrieve values for all columns that can be updated and refreshes all timestamp columns in a row in the DataStore.
    Reset() bool Clears all the data from the DataStore.
    ResetUpdate() bool Clears the update flags in the primary and filter buffers and empties the delete buffer of the DataStore.
    Retrieve(params object[] arguments) int Retrieves rows from the database. If arguments are included, the argument values are used for the retrieval arguments in the SQL SELECT statement for the DataStore.
    RowsCopy(int startrow, int endrow, DwBuffer copybuffer, IDataStoreBase targetdw, int beforerow, DwBuffer targetbuffer) bool Copies a range of rows from one DataStore to another, or from one buffer to another within a single DataStore.
    RowsDiscard(int startrow, int endrow, DwBuffer bufferType) bool Discards a range of rows in the DataStore. Once a row has been discarded using RowsDiscard, you cannot restore the row unless you retrieve it again from the database.
    RowsMove(int startrow, int endrow, DwBuffer movebuffer, IDataStoreBase targetdw, int beforerow, DwBuffer targetbuffer) bool Clears a range of rows from one DataStore and inserts them in another. Alternatively, RowsMove can move rows from one buffer to another within a single DataStore.
    SetDataContext(DataContext context) bool Sets the data context.
    SetFilter(string format) bool Specifies the filter criteria for the DataStore.
    SetItem(int row, short column, object value) bool Sets the value of a row and column (by column name) in the DataStore to the specified value.
    SetItem(int row, string column, object value) bool Sets the value of a row and column (by column number) in the DataStore to the specified value.
    SetItemStatus(int row, short column, DwBuffer bufferType, PropertyState status) bool Sets the modification status in the column (by column number) for a row in the specified buffer of the DataStore.
    SetItemStatus(int row, string column, DwBuffer bufferType, PropertyState status) bool Sets the modification status in the column (by column name) for a row in the specified buffer in the DataStore.
    SetModel<TModel>(int row, TModel model) void Sets the data for the specified row.
    SetSort(string format) bool Specifies the sort criteria for the DataStore.
    SetSqlSelect(string statement, bool isValidation = true) bool Specifies the SQL SELECT statement for the DataStore.
    SetValidate(short column, string rule) bool Sets the validation rule for a column (specified by column number) in the DataStore.
    SetValidate(string column, string rule) bool Sets the validation rule for a column (specified by column name) in the DataStore.
    Sort(string format = null) bool Sorts the rows in the DataStore using the current sort criteria.
    Sum<TModel>(Func<TModel, decimal> selector) decimal Computes the sum of a sequence of decimal values that are obtained by invoking a transform function on each row of the primary buffer in DataStore.
    Sum<TModel>(Func<TModel, decimal> selector, Predicate<TModel> predicate) decimal Computes the sum of a sequence of System.Decimal values that are obtained by invoking a transform function on each row (filtered by a predicate) of the primary buffer in DataStore.
    Update(bool resetflag = true) int Updates the database with the changes made in the DataStore.
    Update(UpdateSqlStrategy updateSqlStrategy, bool resetFlag = true) int Updates the database with the changes made in the DataStore.
    Validate() bool Verifies the data using the data validation rules set in the DataStore.
    Validate(out List<ValidationResult> ValidationResults) bool Verifies the data using the data validation rules set in the DataStore, and outputs the verification results.

    Extension Methods

    Name Return Type Description
    Describe(string propertyList) string Returns the property values of the DataStore model.
    ExportJson(bool format = false) string Exports data from the DataStore primary buffer to a plain JSON string or DataWindow JSON string..
    ExportJson(bool primarydata, bool filterdata, bool deletedata, bool dwcdata, bool format = false) string Exports data from the specified buffer(s) and/or DataWindowChild to a plain JSON string or DataWindow JSON string.
    ExportJson(DwBuffer dwbuffer, bool changedonly, bool format) string Exports all rows or only the changed rows from all or specified buffers to a plain JSON string or DataWindow JSON string.
    ExportJson(DwBuffer dwbuffer, int startRow = 0, int endRow = -1, int startColumn = 0, int endColumn = -1, bool format = false) string Exports all data or the specified rows and/or columns from the specified buffer to a plain JSON string or DataWindow JSON string.
    GetBlock<TModel>(int startRow, short startColumn, int endRow, short endColumn, DwBuffer bufferType = DwBuffer.Primary, bool isOriginalValue = false) TModel[] Gets the data from the specified range of rows and columns from the specified buffer.
    GetNextModified(int row, DwBuffer dwbuffer) int Reports the next row that has been modified in the specified buffer.
    GetRowData<TModel>(int row, DwBuffer bufferType = DwBuffer.Primary, bool isOriginalValue = false) TModel Gets the data of the specified row in DataStore.
    GetRowsData<TModel>(DwBuffer bufferType = DwBuffer.Primary, bool isOriginalValue = false) TModel[] Gets the data of all rows in the specified buffer.
    GetValues<TValue>(string column, DwBuffer bufferType = DwBuffer.Primary, bool isOriginalValue = false) TValue[] Gets the data of the specified column.
    GetValues<TValue>(string column, int startRow, int endRow, DwBuffer bufferType = DwBuffer.Primary, bool isOriginalValue = false) TValue[] Gets the data from the specified column and from the specified ranges of rows.
    ImportJson(string json, ref string error, DwBuffer dwbuffer = DwBuffer.Primary, int startRow = 0, int endRow = -1, int startColumn = 0, int endColumn = -1, int dwStartColumn = 0) int Inserts data from a JSON string into a DataStore object.
    ImportJsonByKey(string json, ref string error, DwBuffer dwbuffer = DwBuffer.Primary, int startRow = 0, int endRow = -1) int Inserts data from a JSON string into a DataStore object according to the key name of the JSON item.
    ImportRowFromJson(string json, int row, ref string error, DwBuffer dwbuffer = DwBuffer.Primary) int Inserts a data row from a JSON string into a DataStore object.
    ImportString(DataFormat importType, string text, int startRow = 0, int endRow = -1, int startColumn = 0, int endColumn = -1, int dwStartColumn = 0) int Inserts the data from a string to DataStore. The string can be in the format of JSON, XML, or TXT.
    Modify(string modString) string Modifies a DataStore object by applying specifications, given as a list of instructions, that change the DataStore object's definition.
    SetBlock(int startRow, short startColumn, int endRow, short endColumn, object value, DwBuffer bufferType = DwBuffer.Primary) void Sets the data values for the specified range of rows and columns in DataStore.
    SetItem(int row, short column, object value, DwBuffer bufferType = DwBuffer.Primary) void Sets the data value at the specified row and column in the specified buffer.
    SetItem(int row, string column, object value, DwBuffer bufferType = DwBuffer.Primary) void Sets the data value at the specified row and column in the specified buffer.
    SetRowData(int row, object value, DwBuffer bufferType = DwBuffer.Primary) void Sets the data value for the specified row in the specified buffer of DataStore.
    SetRowsData(object value, DwBuffer bufferType = DwBuffer.Primary) void Sets the data value for the specified rows in the specified buffer of DataStore.
    SetValues(string column, int startRow, int endRow, object value, DwBuffer bufferType = DwBuffer.Primary) void Sets the data value for the specified column and the specified range of rows in the specified buffer.
    SetValues(string column, object value, DwBuffer bufferType = DwBuffer.Primary) void Sets the data value for the specified column in the specified buffer.
    Update(bool resetFlag, PbResultStyle resultStyle) int Updates the database with the changes made in the DataStore.

    Events

    Name Description
    RetrieveEnd Occurs when DataStore retrieval is completed.
    RetrieveStart Occurs when the DataStore retrieval is about to begin.
    RowDeleted Occurs when the deletion of the DataStore row is completed.
    RowDeleting Occurs when the deletion of the DataStore row is about to begin.
    UpdateEnd Occurs when committing DataStore updates to the database is completed.
    UpdateStart Occurs after the Update method is called and before changes in the DataStore are sent to the database.

    Remarks

    .NET DataStore is used in almost exactly the same way as the PowerBuilder DataStore; and on top of that, .NET DataStore also supports to use the advanced .NET development methods, such as LINQ set operations. .NET DataStore is very useful when you want to access the database and manipulate the data.
    1 Access the data in the database.
    2 Append, delete, modify or query the data and commit the change to the database conveniently.
    3 Group or sort the data.
    4 Manage the database transactions automatically or manually.
    5 Check the data validity and integrity.
    6 Track the data modification.
    7 Used as the replacement for the migrated PowerBuilder DataStore.

    When .NET DataStore is created, it must be associated with a DataWindow object. It uses the Retrieve method to obtain the data and place the data to the primary buffer. Parameters defined in the DataWindow can also be passed in to retrieve data. AddRow method can be used to append data to the DataStore; and DeleteRow method can be used to remove data from the DataStore, however, data is not directly deleted from the DataStore, it is only moved to the delete buffer where you can still manipulate it later. SetSort method can be used to set the sorting criteria and Sort method to sort the data according to the predefined criteria. SetFilter method can be used to filter the data, and the data will be moved to the filter buffer. Update method can be used to finally commit the change to the database.
    .NET DataStore also provides many events that will occur on data change; these events include OnRowDeleting, OnRowDeleted, OnRetrieveStart, OnRetrieveEnd, OnUpdateStart, and OnUpdateEnd.

    Back to top Generated by Appeon