IDataStoreBase.UpdateEnd Event
.NET Standard 2.x
Occurs when the Update
method is called and after data changes are committed to the database.
Namespace: DWNet.Data
Assembly: DWNet.Data.dll
Syntax
public event DwEventHandler<object, DwUpdateEventArgs> OnUpdateEnd;
Remarks
In this event, you can use:
DwUpdateEventArgs.RowsInserted
to receive the number of rows inserted;DwUpdateEventArgs.RowsUpdated
to receive the number of rows updated;DwUpdateEventArgs.RowsDeleted
to receive the number of rows deleted.
Examples
The following code example demonstrates that the UpdateEnd
event is triggered when update finished in the DataStore.
using DWNet.Data;
using System;
namespace Appeon.ApiDoc.IDataStoreBaseExamples
{
public class UpdateEndExample
{
private SchoolContext _context;
public UpdateEndExample(SchoolContext dataContext)
{
// Sets the data context.
_context = dataContext;
}
public void Example()
{
// Instantiates datastore with datawindow: d_department
var department = new DataStore("d_department", _context);
// Inserts a department record.
decimal id = 1;
var insertRow = department.InsertRow(0);
department.SetItem(insertRow, "Departmentid", 10);
department.SetItem(insertRow, "Name", "test depart");
department.SetItem(insertRow, "Budget", id);
department.SetItem(insertRow, "Startdate", DateTime.Parse("2018-12-12"));
// Defines what to do after Update completes.
department.UpdateEnd +=
(object sender, DwUpdateEventArgs args) =>
{
Console.WriteLine("{0} records have been updated into the database.",
args.RowsInserted);
};
department.Update();
/*This code produces the following output:
1 records have been updated into the database.
*/
}
}
}
Example Refer To
Model Class: D_Department
DataWindow File: d_department
Applies to
.NET Standard
2.x