New Posts New Posts RSS Feed: Object Custom Fields
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Object Custom Fields

 Post Reply Post Reply
Author
amit007 View Drop Down
Newbie
Newbie
Avatar

Joined: 10-Mar-2009
Posts: 10
Post Options Post Options   Quote amit007 Quote  Post ReplyReply Direct Link To This Post Topic: Object Custom Fields
    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

 
Back to Top
ting View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 27-Mar-2009
Location: San Francisco
Posts: 427
Post Options Post Options   Quote ting Quote  Post ReplyReply Direct Link To This Post 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.
 
 
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down