IDataStoreBase.UpdateStart Event
.NET Standard 2.x
Occurs when the Update
method is called and before data changes are committed to the database.
Namespace: DWNet.Data
Assembly: DWNet.Data.dll
Syntax
public event DwEventHandler<object, DwUpdateEventArgs> UpdateStart;
Remarks
In this event, you can set DwUpdateEventArgs.IsCancel
to true
to cancel the update.
Examples
The following code example demonstrates that the UpdateStart
event is triggered when update starts in the DataStore.
using DWNet.Data;
using System;
namespace Appeon.ApiDoc.IDataStoreBaseExamples
{
public class UpdateStartExample
{
private SchoolContext _context;
public UpdateStartExample(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 data to the model
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 when update is being executed.
department.UpdateStart +=
(object sender, DwUpdateEventArgs args) =>
{
Console.WriteLine("Update starts...");
};
department.Update();
/*This code produces the following output:
Update starts...
*/
}
}
}
Example Refer To
Model Class: D_Department
DataWindow File: d_department
Applies to
.NET Standard
2.x