Some developers store all dates in the database as UTC. When materializing dates, it would be nice for DO to set their Kind property to Utc instead of Unspecified. "Unspecified" causes a lot of unintended consequences. For example, if I have a JSON service that queries and returns some entities that have Date fields, then the .NET JavaScriptSerializer class will first convert my "already UTC" dates to UTC again. This is a very common use-case in ASP.NET MVC. For example, let's say that the date January 1, 1970 midnight UTC (Unix epoch) is stored in a database. When DO materializes this date as part of an entity, it materializes the DateTime instance with DateTimeKind.Unspecified. When JavaScriptSerializer serializes it into JSON, it first converts it to UTC, thinking that it represents local time. So, if my server is in New York, it will be converted to 5AM, which is wrong. For now, I am materializing dates using DateTime.SpecifyKind(myEntity.Date, DateTimeKind.Utc). It would be nice to be able to remove all such repetitive statements from my code. |
Hello Ara, Support of |