We've got a scheduling application running that calls a WCF service to run nightly jobs. A large number of these include information about the current business date. For business reasons the scheduling server is set to GMT, but our service is running on servers set to NY time.
This raises a problem; the dates are being passed to our .NET service with explicit timezone information. So when the service tells the application to run with a date of "2008-11-03 00:00:00 +0:00", the service interprets that as "2008-11-02 19:00:00 -5:00" and things run with the wrong date.
The scheduler behavior is third-party and hard coded, so we can't tell the scheduler to omit the timezone offset. We don't want to always convert the date to GMT because there's a real possibility that our asian offices will call the same service and we'll be back to the same problem.
Is there a way to flag the DataContract, or even control it at a low enough level to make sure the DateTime Kind will be Unspecified? Or is there a way with a DateTime to determine what the original information used to create it was and convert it back to the original value in a post-processing step?
If it helps, right now our contract is fairly simple. Methods take one parameter which is a class derived from the class below.
[DataContract]
public class BaseTimeSensitiveParameters
{
[DataMember] public DateTime? BusinessDate;
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…