This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Hi, I'm looking for some advice on working with the DateTime.Kind property. In particular is there a way to have Lightspeed set DateTime.Kind to DateTimeKind.Utc when it loads an entity's CreatedOn, UpdatedOn and DeletedOn from a database? And is there a way to do the same for other DateTime typed properties on an entity? Thanks Andrew (using Lightspeed 4) |
|
|
Hi Andrew, If you want to have LightSpeed use UTC values when computing the tracking fields (CreatedOn, UpdatedOn, DeletedOn) you should set LightSpeedContext.AutoTimestampMode = AutoTimestampMode.Utc on your LightSpeedContext. Are the values you are storing currently in UTC? Also have a look at this thread for a suggestion on how to convert arbitrary DateTime properties in and out of UTC for persistance - you would just flip this around if you are storing local times and surfacing UTC based values: http://www.mindscapehq.com/forums/thread/2974
|
|
|
Hi Jeremy, Yes, we have AutoTimestampMode set to AutoTimestampMode.Utc and the values for CreatedOn, UpdatedOn and DeletedOn are stored correctly as UTC in the database. But when I look at these properties on my objects I see that the Kind property is set to Unspecified rather than UTC. Is it possible for Lightspeed to set these properties to UTC when it loads them? Thanks Andrew |
|
|
Hi Andrew, Yes, I will look into this and will let you know once we have an update.
|
|
|
Hi Andrew, I have added in an update which covers setting DateTime.Kind to Utc for the tracking properties that are materialized when the AutoTimestampMode is set to Utc and this will be available in the next nightly build for you.
|
|