We are using LLBLGEN Pro 2.0, Adapter Model and WCF for communication.
We have to set few Entity DateTime Fields to UTC kind ( these are defined as DATE columns in Oracle DB) either during loading the Entity if possible. If not set them UTC kind before sending them to Client.
Before sending the Entity to the Client side, I had set the StatusDate of the Entity as follows.
DateTime statusDateUTC = DateTime.SpecifyKind(DateTime.Now, DateTimeKind.Utc);
//UwApplEntity.StatusDate = DateTime.SpecifyKind(DateTime.Now, DateTimeKind.Utc);
UwApplEntity.StatusDate = DateTime.Now;
UwApplEntity.StatusDate = statusDateUTC;
UwApplEntity.IsDirty = false;
I had received the following message from Managed Debugging Assistants. And the DateTimeKind is lost at the client side.
DateTimeInvalidLocalFormat Was Detected
A UTC DateTime is being converted to text in a format that is only correct for local times. This can happen when calling DateTime.ToString using the 'z' format specifier, which will include a local time zone offset in the output. In that case, either use the 'Z' format specifier, which designates a UTC time, or use the 'o' format string, which is the recommended way to persist a DateTime in text. This can also occur when passing a DateTime to be serialized by XmlConvert or DataSet. If using XmlConvert.ToString, pass in XmlDateTimeSerializationMode.RoundtripKind to serialize correctly. If using DataSet, set the DateTimeMode on the DataColumn object to DataSetDateTime.Utc.
How can I have the DateTime Serialized at the client side with out loosing the UTC kind?