Print Page | Close Window

Object Custom Fields

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2009
Forum Discription: For .NET 3.5
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=1735
Printed Date: 20-Sep-2025 at 12:06pm


Topic: Object Custom Fields
Posted By: amit007
Subject: Object Custom Fields
Date Posted: 21-Apr-2010 at 6:10am

I need to get server time that would basically tell me when object was last queried on. For this, I need to create fields on entity and set its value to DateTime.Now.  Since same set of classes get use on server site and client site, I would always get client time. Is there any way to set the fields with server time?
 
Thanks,
Amit

 



Replies:
Posted By: ting
Date Posted: 21-Apr-2010 at 8:46pm
Hi Amit,
 
You could call InvokeServerMethod() to get the server time.  That's a simple approach.
 
However, if you need more secure auditing, this should be done on the server.  One way to do this is to implement the IEntityServerFetching interface on the server and log the access to those entities/rows (typically in a separate logging table).
 
In IEntityServerFetching, you are passed the query, so you can examine it or even execute it in a server-side EntityManager to see which entities will be returned (subject to concurrency conditions), and then add the appropriate records to the audit table.  This is a more involved approach, however.
 
 



Print Page | Close Window