Attribute: [UpdateFunction]
Posted by Gerhard Stephan on March 21st, 2007
The UpdateFunction attribute is used to define a database function that is called when updating the object in database. This function might be used to store the lastupdate of an object to database. Have a look at the following example.
/// <summary>
/// Gets or sets the last updated.
/// </summary>
/// <value>The last updated.</value>
[UpdateFunction("GETDATE()")]
public DateTime LastUpdated
{
get { return lastUpdated; }
set { lastUpdated = value; }
}
The created SQL looks like:
UPDATE DATABASEFUNCTION SET [LASTUPDATED] = GETDATE() WHERE [DATABASEFUNCTION].[ID]=’12fca955-12ba-4486-bf89-4bf92d6db13d’;
