IDataStoreBase.ModifiedCount Property
.NET Standard 2.x
Gets the number of rows that have been modified in the DataStore but not updated to the database.
Namespace: DWNet.Data
Assembly: DWNet.Data.dll
Syntax
public int ModifiedCount { get; }
Property Value
System.Int32
The number of rows that have been modified in the DataStore but not updated to the database.
Remarks
ModifiedCount
reports the number of rows that are scheduled to be added or updated in the database table associated with the DataStore. This includes rows in the primary and filter buffers.
A newly inserted row (with a status flag of ModelState.New
) is not included in the modified count until that row is populated with data (its status flag becomes ModelState.NewModified
).
The DeletedCount
property gets the number of rows in the delete buffer. The RowCount
property gets the total number of rows in the primary buffer.
Examples
The following code example modifies the first and the last rows in the DataStore and then uses the ModifiedCount
property to get the total number of the modified rows.
using DWNet.Data;
using System;
namespace Appeon.ApiDoc.IDataStoreBaseExamples
{
public class ModifiedCountExample
{
private readonly SchoolContext _context;
public ModifiedCountExample(SchoolContext dataContext)
{
// Sets the data context
_context = dataContext;
}
public void Example()
{
// Instantiates datastore with datawindow: d_department.
var datastore = new DataStore("d_department", _context);
datastore.Retrieve();
Console.WriteLine("Retrieved Rowcount: {0}",
datastore.RowCount);
// Modifies the budget value for the first row.
datastore.SetItem(0, "budget", 220000.00m);
// Modifies the name value for the last row.
datastore.SetItem(datastore.RowCount - 1, "name", "New Department");
Console.WriteLine("After data is modified, Modifiedcount: {0}",
datastore.ModifiedCount);
/*This code produces the following output:
Retrieved Rowcount: 4
After data is modified, Modifiedcount: 2
*/
}
}
}
Example Refer To
Model Class: D_Department
DataWindow File: d_department
Applies to
.NET Standard
2.x