0

Suppose that on your ProjectBus you created an entity class name is Person and here is our function does ;

    Person p=new Person(){Name=Dummy Smith,LastLoginDate=DateTime.Now,....};
    personEntityService.Persons.Add(p);
    personEntityService.SubmitChanges();

I think we trust the datetime on client side,because we got client date.

If an operation is financial or pathologically important,client can fraud us. Or we may cause client's loss.

So I'm asking for best practices.

One solution we applied is getting server datetime and looking diffrence between server and client during login process.(or before any transaction on your transaction bridge) If the datetime diffrence is not applicable reject operation and throw your date is wrong!

Or we may do not use DateTime funcs. on client code ,they will be filled in server side. For this scenario we need to use db default fields or(and) we manage domain service class's submit ops.etc.

So what is formal,most choosen way of managing date fields in Silverlight Rich Internet Apps.

Any comment will be appreciated.

Davut Gürbüz
  • 5,526
  • 4
  • 47
  • 83
  • If you trust the time on the server then use that, and always disregard any times coming from the client. – slugster May 09 '12 at 12:17
  • Its ok!.Now,so do I need to get the date from server and use it on client code or do I need after client's SubmitOperation() on server side submit or server side invokeOperation assign real values? – Davut Gürbüz May 09 '12 at 12:25
  • 1
    The dates you send to the client will normally be from the database. Any new dates should be populated on the server before saving the data, any dates that come back from the client you can disregard and not save unless it is one the user can set (in which case you have to trust their input). – slugster May 09 '12 at 13:20
  • Thanks for your advices, It seems that its up to your date fileds meaning. For some dates they must pass over a rule engine([MustBeGreaterThanNowAttrib]BirthDate),some dates may ommitable,some dates are very serious(such as billing date). So its hard to generallize this.I just want to emphasis we need to care DateTime.Now is not always same between server and client.We must use both of them very carefully. Server and client dates can be wrong sometimes. If its very critical maybe getting universal time from a service will be meaningfull. I write this comment from Turkey,maybe s.one is elsewher – Davut Gürbüz May 09 '12 at 14:00

0 Answers0