It would be useful to me to be able to set a field value to some expression that would be evaluated by the database server, for example, to set a Date field to 'sysdate' in Oracle, or to the result of a function call. I use timestamps (not SQL Server 'timestamps' and not for concurrency), and want to rely on the 'one true time' on the database server to avoid confusion.
For example, to save an entity, and set one field to the current time and another to 'duration' seconds in the future, using database-evaluated expressions, the hypothetical code might be:
FooEntity foo = ...;
...
foo.SetFieldToDatabaseExpression(FooEntityField.StartTime, "systimestamp");
foo.SetFieldToDatabaseExpression(FooEntityField.FinishTime, "add_seconds(systimestamp, 123)");
At the moment, I have worked around the inability to do this sort of thing by adding a 'duration' field that is only used to communicate the 'duration' to the server, and implementing a trigger on the table in question that reads this duration, fills in 'startTime' and 'endtime' fields, and resets the duration field (so that if somebody sets it again, the database 'notices').
I can see issues with this type of functionality of course: a possible SQL injection risk?, and it would add complexity to the DAL code of course.
I'm interested though in people's thoughts on the issue.