Attribute: [SelectFunction]
Posted by Gerhard Stephan on March 21st, 2007
The SelectFunction attribute is used to define a database function that is called when selecting the object from database. This function might be used to get the last access date of an object in database. Have a look at the following example.
/// <summary>
/// Gets or sets the last read.
/// </summary>
/// <value>The last read.</value>
[SelectFunction("GETDATE()")]
public DateTime LastRead
{
get { return lastRead; }
set { lastRead = value; }
}
The created SQL looks like:
SELECT [DATABASEFUNCTION].* , GETDATE() as LASTREAD FROM [DATABASEFUNCTION] WHERE [DATABASEFUNCTION].[ID]=’12fca955-12ba-4486-bf89-4bf92d6db13d’;
