DataStore<TModel> Class
.NET Standard 2.x
The DataStore<TModel> class provides generic .NET DataStores which are designed in native .NET style, therefore, it requires the developer to have knowledge in the .NET technology and understand what "generic" means.
Namespace: DWNet.Data
Assembly: DWNet.Data.dll
Syntax
public class DataStore<TModel> : DataStoreBase, IDataStore<TModel>
Constructors
Name | Description |
---|---|
DataStore() | Initializes a new instance of the DataStore class. |
DataStore(DataContext dataContext) | Initializes a new instance of the DataStore class using a DataContext object. |
DataStore(IEnumerable<TModel> items) | Initializes a new instance of the DataStore class using a sequence of TModel objects. |
DataStore(DataContext dataContext, IEnumerable<TModel> items) | Initializes a new instance of the DataStore class using a DataContext object and a sequence of TModel objects. |
Events
Name | Description |
---|---|
RetrieveEnd | Occurs when the 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. |
Properties
Name | Return Type | Description |
---|---|---|
Count | int | Gets the total number of rows in primary buffers of the DataStore. |
Current | TModel | Gets the currently referenced row in the enumerator. |
DataContext | DataContext | Represents the entry to the database. |
DeletedCount | int | Gets the total number of rows that are marked for deletion in the database. |
DwMeta | IDwMeta | Gets the meta data in the DataStore model. |
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. |
Item[int] | TModel | Gets and sets the data row from the index location. |
RowCount | int | Gets the total number of rows in primary buffers of the DataStore. |
ModifiedCount | int | Gets the number of rows that have been modified in the DataStore but not updated to the database. |
TotalCount | int | Gets the total number of rows in all buffers of the DataStore. |
Methods
Name | Return Type | Description |
---|---|---|
Add(TModel item) | void | Appends a TModel instance as a row to the end of the primary buffer in the DataStore. |
All(Func<TModel, bool> predicate) | bool | Determines whether all elements of a sequence satisfy a condition. |
Any(Func<TModel, bool> predicate) | bool | Determines whether any element of a sequence exists or satisfies a condition. |
Average(Func<TModel, long> selector) | double | Computes the average of a sequence of long values. |
Average(Func<TModel, double?> selector) | double? | Computes the average of a sequence of nullable Double values. |
Average(Func<TModel, double> selector) | double | Computes the average of a sequence of Double values. |
Average(Func<TModel, int> selector) | double | Computes the average of a sequence of Int32 values. |
Average(Func<TModel, int?> selector) | double? | Computes the average of a sequence of nullable Int32 values. |
Average(Func<TModel, long?> selector) | double? | Computes the average of a sequence of nullable long values. |
Average(Func<TModel, decimal?> selector) | decimal? | Computes the average of a sequence of nullable Decimal values. |
Average(Func<TModel, float> selector) | float | Computes the average of a sequence of float values. |
Average(Func<TModel, float?> selector) | float? | Computes the average of a sequence of nullable float values. |
Average(Func<TModel, decimal> selector) | decimal | Computes the average of a sequence of Decimal values. |
Average(Func<TModel, long> selector, Predicate<TModel> predicate) | double | Computes the average of a sequence of double values. |
Average(Func<TModel, double?> selector, Predicate<TModel> predicate) | double? | Computes the average of a sequence of double? values. |
Average(Func<TModel, double> selector, Predicate<TModel> predicate) | double | Computes the average of a sequence of double values. |
Average(Func<TModel, int> selector, Predicate<TModel> predicate) | double | Computes the average of a sequence of double values. |
Average(Func<TModel, int?> selector, Predicate<TModel> predicate) | double? | Computes the average of a sequence of double? values. |
Average(Func<TModel, long?> selector, Predicate<TModel> predicate) | double? | Computes the average of a sequence of double? values. |
Average(Func<TModel, decimal?> selector, Predicate<TModel> predicate) | decimal? | Computes the average of a sequence of decimal? values. |
Average(Func<TModel, float> selector, Predicate<TModel> predicate) | float | Computes the average of a sequence of float values. |
Average(Func<TModel, float?> selector, Predicate<TModel> predicate) | float? | Computes the average of a sequence of float? values. |
Average(Func<TModel, decimal> selector, Predicate<TModel> predicate) | decimal | Computes the average of a sequence of decimal values. |
BinarySearch<TValue>(Func<TModel, TValue> searchProperty, TValue propertyValue) | int | Searches for the index number of the specified property name and value in the primary buffer. The index number is the same as the zero-based row number in the primary buffer. |
Contains(TModel item) | bool | Determines whether a data row exists in the primary buffer of the DataStore. |
CopyTo(TModel[] array, int arrayIndex) | void | Copies all rows from the primary buffer of the DataStore to a compatible one-dimensional array, starting at the specified array index. |
Clear() | void | Clears data from all buffers. |
Exists(Predicate<TModel> predicate, DwBuffer bufferType = DwBuffer.Primary) | bool | Determines whether there is a row in the primary buffer of the DataStore that meets the specified condition. |
Filter() | 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(Predicate<TModel> predicate, bool removeFiltered = false) | bool | Filters rows based on the filter criteria specified by Predicate <TModel> and specifies whether rows that do not meet the filter criteria are moved to the filter buffer. |
Find(Predicate<TModel> predicate, DwBuffer bufferType = DwBuffer.Primary) | TModel | Finds the next row in the specified buffer of the DataStore in which data meets the condition specified by the expression. |
Find(Predicate<TModel> predicate, bool calcCompute, DwBuffer bufferType = DwBuffer.Primary) | TModel | Finds the next row in the specified buffer of the DataStore in which data meets the condition specified by the expression. |
FindAll(Predicate<TModel> predicate) | IList<TModel> | Finds the all rows in the specified buffer of the DataStore in which data meets the condition specified by the expression. |
FindAll(Predicate<TModel> predicate, bool calcCompute) | IList<TModel> | Finds the all rows in the specified buffer of the DataStore in which data meets the condition specified by the expression. |
FindIndex(Predicate<TModel> predicate) | int | Returns the index number of the next row in the primary buffer of the DataStore in which data meets the condition specified by the expression. |
FindLast(Predicate<TModel> predicate, DwBuffer bufferType = DwBuffer.Primary) | TModel | Returns the index of the last row in the DataStore in which data meets the criteria defined by the predicate. |
FindLast(Predicate<TModel> predicate, bool calcCompute, DwBuffer bufferType = DwBuffer.Primary) | TModel | Returns the index of the last row in the DataStore in which data meets the criteria defined by the predicate. |
FindLastIndex(Predicate<TModel> predicate) | int | Returns the last index of the next row in the DataStore in which data meets the criteria defined by the predicate. |
GetChild<TChildModel>(string name) | IDataStore<TChildModel> | Provides a reference to the DataWindowChild , which you can use to manipulate that DataStore. |
GetChild<TChildModel>(string name, out IDataStore<TChildModel> child) | bool | Provides a reference to the DataWindowChild , which you can use to manipulate that DataStore. |
GetChild<TChildModel>(Expression<Func<TModel, object>> columnSelector) | IDataStore<TChildModel> | Provides a reference to the DataWindowChild , which you can use to manipulate that DataStore. |
GetChild<TChildModel>(Expression<Func<TModel, object>> columnSelector, out IDataStore<TChildModel> child) | bool | Provides a reference to the DataWindowChild , which you can use to manipulate that DataStore. |
GetDataExporter(DataFormat dataFormat) | IDwDataExporter | Gets the DataStore exporter, you need to specify the data export format(DataFormat ). |
GetDataImporter(DataFormat dataFormat) | IDwDataImporter | Gets the DataStore importer, you need to specify the data import format(DataFormat ). |
GetForUpdate(int index) | TModel | Obtains the TModel object of the specified row index number. |
GetForUpdate(Predicate<TModel> predicate) | TModel | Obtains the TModel object of the specified condition. |
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. You can obtain the data that was originally retrieved and stored in the database, as well as the current value in the primary, delete, or filter buffers. |
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. You can obtain the data that was originally retrieved and stored in the database, as well as the current value in the primary, delete, or filter buffers. |
GetItem<TValue>(int row, Func<TModel, TValue> columnSelector, DwBuffer bufferType = DwBuffer.Primary, bool isOriginalValue = false) | TValue | Gets the data for the specified row and column from the specified buffer of the DataStore. |
GetItemStatus(int row, short column, DwBuffer bufferType = DwBuffer.Primary) | PropertyState | Gets the modification status of a column (specified by column number) within a row in the specified buffer. The modification status determines the type of SQL statement the Update method will generate for the row or column. |
GetItemStatus(int row, string column, DwBuffer dwbuffer = DwBuffer.Primary) | PropertyState | Gets the modification status of a column (specified by column name) within a row in the specified buffer. The modification status determines the type of SQL statement the Update method will generate for the row or column. |
GetItemStatus<TModel>(int row, Expression<Func<TModel, object>> selector, DwBuffer dwbuffer = DwBuffer.Primary) | PropertyState | Gets the modification status of a column (specified by an expression) within a row in the specified buffer. |
GetReport<TReportModel>(int, string) | IDataStore<TReportModel> | Gets the report from the composite or nested report. |
GetRowFromRowId(int rowid, DwBuffer dwBuffer = 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 dwBuffer = 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 dwbuffer = DwBuffer.Primary) | ModelState | Gets the modification status of a row. The modification status determines the type of SQL statement the Update method will generate for the row. |
GetSqlSelect() | string | Gets the SQL SELECT statement for the current DataStore. |
GetTemplate() | IDataTemplate | Gets the default XML format template for DataStore data export. |
GetTemplate(string templateName, DataFormat dataFormat = DataFormat.Xml) | IDataTemplate | Specifies the name and format to get the template for DataStore data export. |
GroupBy<TKey>(Func<TModel, TKey> keySelector) | IEnumerable<IGrouping<TKey, TModel>> | Groups rows of the primary buffer by the level of grouping criteria of DataStore. The sort criteria can be specified. |
GroupBy<TKey>(Func<TModel, TKey> keySelector, IEqualityComparer<TKey> comparer) | IEnumerable<IGrouping<TKey, TModel>> | Groups rows of the primary buffer by the level of grouping criteria of DataStore. The sort criteria can be specified. |
GroupBy<TKey, TElement>(Func<TModel, TKey> keySelector, Func<TModel, TElement> elementSelector) | IEnumerable<IGrouping<TKey, TElement>> | Groups rows of the primary buffer by the level of grouping criteria of DataStore. The sort criteria can be specified. |
GetListForUpdate(Predicate<TModel> predicate) | IEnumerable<TModel> | Obtains the IEnumerable<TModel> object of the specified condition. |
GetModel(int row, bool calcCompute = false) | TModel | Obtains the TModel object of the specified row. |
GetValues<TValue>(Func<TModel, TValue> selector, DwBuffer bufferType = DwBuffer.Primary) | IEnumerable<TValue> | Obtains a collection of values of the column (specified by expression), from the specified buffer in the DataStore. |
IndexOf(TModel item) | int | Determines the index number of a specific model instance in the primary buffer of DataStore. |
Insert(int index, TModel item) | void | Inserts a TModel object as a data row at the position (specified by index) in the primary buffer of the DataStore. |
ImportEntry(IModelEntry modelEntry) | int | Imports an IModelEntry object, which contains data and state, to the end of the DataStore. |
ImportEntry(IEnumerable<IModelEntry> modelEntries) | int | Imports a sequence of IModelEntry objects, which contain data and state, to the end of the DataStore. |
Max(Func<TModel, long> selector) | long | Invokes a transform function on each row of the primary buffer in the DataStore and returns the maximum result value. |
Max(Func<TModel, decimal?> selector) | decimal? | Invokes a transform function on each row of the primary buffer in the DataStore and returns the maximum result value. |
Max(Func<TModel, double?> selector) | double? | Invokes a transform function on each row of the primary buffer in the DataStore and returns the maximum result value. |
Max(Func<TModel, float> selector) | float | Invokes a transform function on each row of the primary buffer in the DataStore and returns the maximum result value. |
Max(Func<TModel, long?> selector) | long? | Invokes a transform function on each row of the primary buffer in the DataStore and returns the maximum result value. |
Max(Func<TModel, float?> selector) | float? | Invokes a transform function on each row of the primary buffer in the DataStore and returns the maximum result value. |
Max(Func<TModel, int> selector) | int | Invokes a transform function on each row of the primary buffer in the DataStore and returns the maximum result value. |
Max(Func<TModel, int?> selector) | int? | Invokes a transform function on each row of the primary buffer in the DataStore and returns the maximum result value. |
Max(Func<TModel, double> selector) | double | Invokes a transform function on each row of the primary buffer in the DataStore and returns the maximum result value. |
Max(Func<TModel, decimal> selector) | decimal | Invokes a transform function on each row of the primary buffer in the DataStore and returns the maximum result value. |
Max(Func<TModel, long> selector, Predicate<TModel> predicate) | long | Invokes a transform function on each row of the primary buffer in the DataStore and returns the maximum result value. |
Max(Func<TModel, decimal?> selector, Predicate<TModel> predicate) | decimal? | Invokes a transform function on each row of the primary buffer in the DataStore and returns the maximum result value. |
Max(Func<TModel, double?> selector, Predicate<TModel> predicate) | double? | Invokes a transform function on each row of the primary buffer in the DataStore and returns the maximum result value. |
Max(Func<TModel, float> selector, Predicate<TModel> predicate) | float | Invokes a transform function on each row of the primary buffer in the DataStore and returns the maximum result value. |
Max(Func<TModel, long?> selector, Predicate<TModel> predicate) | long? | Invokes a transform function on each row of the primary buffer in the DataStore and returns the maximum result value. |
Max(Func<TModel, float?> selector, Predicate<TModel> predicate) | float? | Invokes a transform function on each row of the primary buffer in the DataStore and returns the maximum result value. |
Max(Func<TModel, int> selector, Predicate<TModel> predicate) | int | Invokes a transform function on each row of the primary buffer in the DataStore and returns the maximum result value. |
Max(Func<TModel, int?> selector, Predicate<TModel> predicate) | int? | Invokes a transform function on each row of the primary buffer in the DataStore and returns the maximum result value. |
Max(Func<TModel, double> selector, Predicate<TModel> predicate) | double | Invokes a transform function on each row of the primary buffer in the DataStore and returns the maximum result value. |
Max(Func<TModel, decimal> selector, Predicate<TModel> predicate) | decimal | Invokes a transform function on each row of the primary buffer in the DataStore and returns the maximum result value. |
Min(Func<TModel, long> selector) | long | Invokes a transform function on each row of the primary buffer in the DataStore and returns the minimum result value. |
Min(Func<TModel, decimal?> selector) | decimal? | Invokes a transform function on each row of the primary buffer in the DataStore and returns the minimum result value. |
Min(Func<TModel, double?> selector) | double? | Invokes a transform function on each row of the primary buffer in the DataStore and returns the minimum result value. |
Min(Func<TModel, float> selector) | float | Invokes a transform function on each row of the primary buffer in the DataStore and returns the minimum result value. |
Min(Func<TModel, long?> selector) | long? | Invokes a transform function on each row of the primary buffer in the DataStore and returns the minimum result value. |
Min(Func<TModel, float?> selector) | float? | Invokes a transform function on each row of the primary buffer in the DataStore and returns the minimum result value. |
Min(Func<TModel, int> selector) | int | Invokes a transform function on each row of the primary buffer in the DataStore and returns the minimum result value. |
Min(Func<TModel, int?> selector) | int? | Invokes a transform function on each row of the primary buffer in the DataStore and returns the minimum result value. |
Min(Func<TModel, double> selector) | double | Invokes a transform function on each row of the primary buffer in the DataStore and returns the minimum result value. |
Min(Func<TModel, decimal> selector) | decimal | Invokes a transform function on each row of the primary buffer in the DataStore and returns the minimum result value. |
Min(Func<TModel, long> selector, Predicate<TModel> predicate) | long | Invokes a transform function on each row of the primary buffer in the DataStore and returns the minimum result value. |
Min(Func<TModel, decimal?> selector, Predicate<TModel> predicate) | decimal? | Invokes a transform function on each row of the primary buffer in the DataStore and returns the minimum result value. |
Min(Func<TModel, double?> selector, Predicate<TModel> predicate) | double? | Invokes a transform function on each row of the primary buffer in the DataStore and returns the minimum result value. |
Min(Func<TModel, float> selector, Predicate<TModel> predicate) | float | Invokes a transform function on each row of the primary buffer in the DataStore and returns the minimum result value. |
Min(Func<TModel, long?> selector, Predicate<TModel> predicate) | long? | Invokes a transform function on each row of the primary buffer in the DataStore and returns the minimum result value. |
Min(Func<TModel, float?> selector, Predicate<TModel> predicate) | float? | Invokes a transform function on each row of the primary buffer in the DataStore and returns the minimum result value. |
Min(Func<TModel, int> selector, Predicate<TModel> predicate) | int | Invokes a transform function on each row of the primary buffer in the DataStore and returns the minimum result value. |
Min(Func<TModel, int?> selector, Predicate<TModel> predicate) | int? | Invokes a transform function on each row of the primary buffer in the DataStore and returns the minimum result value. |
Min(Func<TModel, double> selector, Predicate<TModel> predicate) | double | Invokes a transform function on each row of the primary buffer in the DataStore and returns the minimum result value. |
Min(Func<TModel, decimal> selector, Predicate<TModel> predicate) | decimal | Invokes a transform function on each row of the primary buffer in the DataStore and returns the minimum result value. |
MoveNext() | bool | Advances the enumerator to the next row of the primary buffer in DataStore. |
Remove(TModel item) | bool | Invokes a transform function on each row of the primary buffer in the DataStore and returns the minimum result value. |
RemoveAll(Predicate<TModel> predicate) | int | Removes rows with specified conditions from the primary buffer of the DataStore. |
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() | void | 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. |
RetrieveByKey(params object[] arguments) | int | Retrieves rows from the database. You can specify a value for a property with the [Key] attribute to retrieve parameters in a SQL SELECT statement in the DataStore. |
RetrieveByKey(TModel model) | int | Retrieves rows from the database. TModel 's property with [Key] attributes are used to retrieve parameters in SQL SELECT statements in the DataStore. |
RetrieveByPage(int currentIndex, int pageSize, params object[] arguments) | int | Retrieves the specified number of rows in the database starting at the specified row position. If a parameter is included, the parameter value is used to retrieve the parameter in the SQL SELECT statement of the DataStore. |
Reverse() | void | Reverses the order of the elements. |
Reverse(int index, int count) | void | Reverses the order of the elements in the specified range. |
RowsCopy(int startrow, int endrow, DwBuffer copybuffer, IDataStore 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 buffer) | 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, IDataStore 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. |
SetItem(int row, short column, object value) | bool | Sets the value of a row and column (by column name) to the specified value. |
SetItem(int row, string column, object value) | bool | Sets the value of a row and column (by column number) to the specified value. |
SetItem(int row, Expression<Func<TModel, object>> columnSelector, object value) | bool | Sets the value of a row and column (by column expression) to the specified value. |
SetItemStatus(int row ,short column, DwBuffer dwbuffer, PropertyState status) | bool | Sets the modification status in the column (by the column number) for a row in the specified buffer of the DataStore. The column modification status along with row modification status determines the type of SQL statement the Update method will generate for the row. |
SetItemStatus(int row, string column, DwBuffer dwbuffer, PropertyState status) | bool | Sets the modification status in the column (by the column name) for a row in the specified buffer in the DataStore. The column modification status along with row modification status determines the type of SQL statement the Update method will generate for the row. |
SetItemStatus(int row, Expression<Func<TModel, object>> columnSelector, DwBuffer bufferType, PropertyState status) | bool | Sets the modification status in the column (by the column expression) for a row in the specified buffer in the DataStore. |
SetModel(int row, TModel model) | void | Sets the data of a TModel object to the specified row of the DataStore. |
SetRowStatus(int row, DwBuffer bufferType, ModelState modelState) | bool | Sets the modification status of the specified row in the specified buffer in the DataStore. The row modification status determines the type of SQL statement the Update method will generate for the row. |
SetSqlSelect(string statement, bool isValidation = true) | bool | Specifies the SQL SELECT statement for the DataStore. |
Sort<TKey>(Func<TModel, TKey> keySelector, bool descending = false) | void | Sorts the rows in the DataStore using the current sort criteria(by the expression). |
SortBy<TKey>(Func<TModel, TKey> keySelector) | IOrderable<TModel> | Sorts the rows in the data store in ascending order using the current sort criteria. |
SortByDescending<TKey>(Func<TModel, TKey> keySelector) | IOrderable<TModel> | Sorts the rows in the data store in descending order using the current sort criteria. |
Sum(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(Func<TModel, double?> selector) | double? | Computes the sum of a sequence of double? values that are obtained by invoking a transform function on each row of the primary buffer in DataStore. |
Sum(Func<TModel, float> selector) | float | Computes the sum of a sequence of float values that are obtained by invoking a transform function on each row of the primary buffer in DataStore. |
Sum(Func<TModel, long?> selector) | long? | Computes the sum of a sequence of long? values that are obtained by invoking a transform function on each row of the primary buffer in DataStore. |
Sum(Func<TModel, float?> selector) | float? | Computes the sum of a sequence of float? values that are obtained by invoking a transform function on each row of the primary buffer in DataStore. |
Sum(Func<TModel, int> selector) | int | Computes the sum of a sequence of int values that are obtained by invoking a transform function on each row of the primary buffer in DataStore. |
Sum(Func<TModel, int?> selector) | int? | Computes the sum of a sequence of int? values that are obtained by invoking a transform function on each row of the primary buffer in DataStore. |
Sum(Func<TModel, double> selector) | double | Computes the sum of a sequence of double values that are obtained by invoking a transform function on each row of the primary buffer in DataStore. |
Sum(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(Func<TModel, long> selector) | long | Computes the sum of a sequence of long values that are obtained by invoking a transform function on each row of the primary buffer in DataStore. |
Sum(Func<TModel, decimal?> selector, Predicate<TModel> predicate) | 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(Func<TModel, double?> selector, Predicate<TModel> predicate) | double? | Computes the sum of a sequence of double? values that are obtained by invoking a transform function on each row of the primary buffer in DataStore. |
Sum(Func<TModel, float> selector, Predicate<TModel> predicate) | float | Computes the sum of a sequence of float values that are obtained by invoking a transform function on each row of the primary buffer in DataStore. |
Sum(Func<TModel, long?> selector, Predicate<TModel> predicate) | long? | Computes the sum of a sequence of long? values that are obtained by invoking a transform function on each row of the primary buffer in DataStore. |
Sum(Func<TModel, float?> selector, Predicate<TModel> predicate) | float? | Computes the sum of a sequence of float? values that are obtained by invoking a transform function on each row of the primary buffer in DataStore. |
Sum(Func<TModel, int> selector, Predicate<TModel> predicate) | int | Computes the sum of a sequence of int values that are obtained by invoking a transform function on each row of the primary buffer in DataStore. |
Sum(Func<TModel, int?> selector, Predicate<TModel> predicate) | int? | Computes the sum of a sequence of int? values that are obtained by invoking a transform function on each row of the primary buffer in DataStore. |
Sum(Func<TModel, double> selector, Predicate<TModel> predicate) | double | Computes the sum of a sequence of double values that are obtained by invoking a transform function on each row of the primary buffer in DataStore. |
Sum(Func<TModel, decimal> selector, Predicate<TModel> predicate) | 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(Func<TModel, long> selector, Predicate<TModel> predicate) | long | Computes the sum of a sequence of long values that are obtained by invoking a transform function on each row 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 |
---|---|---|
ExportJson(this IDataStoreBase dataStore, MappingMethod mappingMethod) | string | Exports data from the DataStore primary buffer to a DataWindow JSON string. |
ExportJson(this IDataStoreBase dataStore, bool changedOnly, MappingMethod mappingMethod) | string | Exports all rows or only the changed rows from the DataStore to a DataWindow JSON string. |
ExportJson(this IDataStoreBase dataStore, 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(this IDataStoreBase dataStore, 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(this IDataStoreBase dataStore, DwBuffer dwbuffer, MappingMethod mappingMethod) | string | Exports data from the specified buffer to a DataWindow JSON string. |
ExportJson(this IDataStoreBase dataStore, 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(this IDataStoreBase dataStore, 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(this IDataStoreBase dataStore, DwBuffer dwbuffer, int startRow, int endRow, int 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(this IDataStoreBase dataStore, DwBuffer dwbuffer, int startRow, int endRow, int startColumn, int 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(this IDataStoreBase dataStore, ) | string | Exports data from the DataStore primary buffer to a plain-format JSON string. |
ExportPlainJson(this IDataStoreBase dataStore, bool changedOnly) | string | Exports all rows or only the changed rows from the DataStore to a plain-format JSON string. |
ExportPlainJson(this IDataStoreBase dataStore, 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(this IDataStoreBase dataStore, 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(this IDataStoreBase dataStore, DwBuffer dwbuffer) | string | Exports data from the specified buffer to a plain-format JSON string. |
ExportPlainJson(this IDataStoreBase dataStore, 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(this IDataStoreBase dataStore, 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(this IDataStoreBase dataStore, 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(this IDataStoreBase dataStore, 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. |
ExportPlainXml(this IDataStoreBase dataStore, ) | string | Exports data from the DataStore primary buffer to a plain-format XML string. |
ExportPlainXml(this IDataStoreBase dataStore, bool changedOnly) | string | Exports all rows or only the changed rows from the DataStore to a plain-format XML string. |
ExportPlainXml(this IDataStoreBase dataStore, DwBuffer dwbuffer, bool changedOnly) | string | Exports all rows or only the changed rows from all or specified buffers to a plain-format or DataWindow XML string. |
ExportPlainXml(this IDataStoreBase dataStore, bool primaryData, bool filterData, bool deleteData, bool dwcdata) | string | Exports data from the specified buffer(s) and/or DataWindowChild to a plain-format XML string. |
ExportPlainXml(this IDataStoreBase dataStore, DwBuffer dwbuffer) | string | Exports data from the specified buffer to a plain-format XML string. |
ExportPlainXml(this IDataStoreBase dataStore, DwBuffer dwbuffer, int startRow) | string | Exports the rows (from the specified starting position to the end) from the specified buffer to a plain-format XML string. |
ExportPlainXml(this IDataStoreBase dataStore, 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 XML string. |
ExportPlainXml(this IDataStoreBase dataStore, 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 XML string. |
ExportPlainXml(this IDataStoreBase dataStore, 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 XML string. |
ExportRowAsJson(this IDataStoreBase dataStore, int row, DwBuffer dwBuffer = DwBuffer.Primary) | string | Exports a data row from the specified buffer to a plain-format JSON string. |
ExportRowAsString(this IDataStoreBase dataStore, int row, DwBuffer dwBuffer = DwBuffer.Primary) | string | Exports a data row from the specified buffer to a TXT string. |
ExportRowAsXml(this IDataStoreBase dataStore, int row, DwBuffer dwBuffer = DwBuffer.Primary) | string | Exports a data row from the specified buffer to an XML string. |
ExportString(this IDataStoreBase dataStore, 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. |
ExportXml(this IDataStoreBase dataStore, MappingMethod mappingMethod) | string | Exports data from the DataStore primary buffer to a DataWindow XML string. |
ExportXml(this IDataStoreBase dataStore, bool changedOnly, MappingMethod mappingMethod) | string | Exports all rows or only the changed rows from the DataStore to a DataWindow XML string. |
ExportXml(this IDataStoreBase dataStore, DwBuffer dwbuffer, bool changedOnly, MappingMethod mappingMethod) | string | Exports all rows or only the changed rows from all or specified buffers to a DataWindow XML string. |
ExportXml(this IDataStoreBase dataStore, bool primaryData, bool filterData, bool deleteData, bool dwcdata, MappingMethod mappingMethod) | string | Exports data from the specified buffer(s) and/or DataWindowChild to a DataWindow XML string. |
ExportXml(this IDataStoreBase dataStore, DwBuffer dwbuffer, MappingMethod mappingMethod) | string | Exports data from the specified buffer to a DataWindow XML string. |
ExportXml(this IDataStoreBase dataStore, 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 XML string. |
ExportXml(this IDataStoreBase dataStore, 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 XML string. |
ExportXml(this IDataStoreBase dataStore, DwBuffer dwbuffer, int startRow, int endRow, int 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 XML string. |
ExportXml(this IDataStoreBase dataStore, DwBuffer dwbuffer, int startRow, int endRow, int startColumn, int 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 XML string. |
ExportString(this IDataStoreBase dataStore, 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(this IDataStoreBase dataStore, 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. |
ImportJson(this IDataStoreBase dataStore, string text) | int | Inserts data from a JSON string into the DataStore. |
ImportJson(this IDataStoreBase dataStore, string text, DwBuffer dwbuffer) | int | Inserts data from a JSON string into the specified buffer of DataStore. |
ImportJson(this IDataStoreBase dataStore, 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(this IDataStoreBase dataStore, 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(this IDataStoreBase dataStore, 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(this IDataStoreBase dataStore, 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(this IDataStoreBase dataStore, 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(this IDataStoreBase dataStore, string text) | int | Inserts data from a JSON string into the DataStore according to the key name of the JSON item. |
ImportJsonByKey(this IDataStoreBase dataStore, 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(this IDataStoreBase dataStore, 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(this IDataStoreBase dataStore, 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. |
ImportRowFromJson(this IDataStoreBase dataStore, string text, int row, DwBuffer dwBuffer = DwBuffer.Primary) | int | Inserts a data row from a JSON string into a DataStore object�� |
ImportRowFromJson(this IDataStoreBase dataStore, string text, int row, DwBuffer dwBuffer = DwBuffer.Primary) | int | Inserts a data row from a TXT string into a DataStore object�� |
ImportRowFromXml(this IDataStoreBase dataStore, string text, int row, DwBuffer dwBuffer = DwBuffer.Primary) | int | Inserts a data row from an XML string into a DataStore object. |
ImportString(this IDataStoreBase dataStore, string text) | int | Inserts the tab-separated data from a string into the DataStore. |
ImportString(this IDataStoreBase dataStore, string text, int startRow) | int | Inserts the tab-separated data from a string into the DataStore. You can specify the starting and ending rows in the string. |
ImportString(this IDataStoreBase dataStore, 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. |
ImportString(this IDataStoreBase dataStore, 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 columns in the string to be imported. |
ImportString(this IDataStoreBase dataStore, 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 in the string, and specify the number of the first column and the number of the last column in the string to be imported. |
ImportString(this IDataStoreBase dataStore, 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 in the string, and specify the number of the first column and the number of the last column in the string to be imported. You can also specify the number of the first column in the DataStore that should receive data. |
ImportXml(this IDataStoreBase dataStore, string text) | int | Inserts data from an XML string into the DataStore. |
ImportXml(this IDataStoreBase dataStore, string text, DwBuffer dwbuffer) | int | Inserts data from an XML string into the specified buffer of DataStore. |
ImportXml(this IDataStoreBase dataStore, string text, DwBuffer dwbuffer, int startRow) | int | Inserts data from an XML string into the specified buffer of DataStore. You can specify the starting position in the XML array. |
ImportXml(this IDataStoreBase dataStore, string text, DwBuffer dwbuffer, int startRow, int endRow) | int | Inserts data from an XML string into the specified buffer of DataStore. You can specify the starting and ending position in the XML array. |
ImportXml(this IDataStoreBase dataStore, string text, DwBuffer dwbuffer, int startRow, int endRow, int startColumn) | int | Inserts data from an XML string into the specified buffer of DataStore. You can specify the starting and ending positions in the XML array, and you can specify the number of the first key value in the XML object to be imported. |
ImportXml(this IDataStoreBase dataStore, string text, DwBuffer dwbuffer, int startRow, int endRow, int startColumn, int endColumn) | int | Inserts data from an XML string into the specified buffer of DataStore. You can specify the starting and ending positions in the XML array, and you can specify the number of the first key value and the number of the last key value in the XML object to be imported. |
ImportXml(this IDataStoreBase dataStore, string text, DwBuffer dwbuffer, int startRow, int endRow, int startColumn, int endColumn, int dwStartColumn) | int | Inserts data from an XML string into the specified buffer of DataStore. You can specify the starting and ending positions in the XML array, and specify the number of the first key value and the number of the last key value in the XML object to be imported. You can also specify the number of the first column in the DataStore that should receive data. |
ImportXmlByKey(this IDataStoreBase dataStore, string text) | int | Inserts data from an XML string into the DataStore according to the key name of the XML item. |
ImportXmlByKey(this IDataStoreBase dataStore, string text, DwBuffer dwbuffer) | int | Inserts data from an XML string into the specified buffer of DataStore according to the key name of the XML item. |
ImportXmlByKey(this IDataStoreBase dataStore, string text, DwBuffer dwbuffer, int startRow) | int | Inserts data from an XML string into the specified buffer of DataStore according to the key name of the XML item. You can specify the starting position in the XML array. |
ImportXmlByKey(this IDataStoreBase dataStore, string text, DwBuffer dwbuffer, int startRow, int endRow) | int | Inserts data from an XML string into the specified buffer of DataStore according to the key name of the XML item. You can specify the starting and ending positions in the XML array. |
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.