The ObjectMapper .NET Project

Official blog of the AdFactum ObjectMapper .NET

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’;

 Votes | Average: 0 out of 5 Votes | Average: 0 out of 5 Votes | Average: 0 out of 5 Votes | Average: 0 out of 5 Votes | Average: 0 out of 5 (No Ratings Yet)
Loading ... Loading ...

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>