This question is locked. New answers and comments are not allowed.
Hello, we are using OpenAcess ORM Classic in our project. So far we found classic version to fit better our needs, but have encounter problem with "Use UTC for DateTime" backend setting. It seems that if we setting this value to true manually in code it's beeing ignored.
In our entities we created fields like CreatedDate and LastUpdatedDate, and we set option in forward mapping to set these values to current date. We want these dates to be stored in UTC timezone, for this reason we set "Use UTC for DateTime" to true when we creating database instance, e.g.
But nevertheless dates are inserted in database in local time zone.
Is there any workaround for this. Any help will be appreciated. Thanks.
In our entities we created fields like CreatedDate and LastUpdatedDate, and we set option in forward mapping to set these values to current date. We want these dates to be stored in UTC timezone, for this reason we set "Use UTC for DateTime" to true when we creating database instance, e.g.
_theObjectScopeProvider.myDatabase = Telerik.OpenAccess.Database.Get(
"LocalExpressConnection"
);
_theObjectScopeProvider.myDatabase.BackendConfiguration.Runtime.UseUTCForAutoSetValues =
true
;
But nevertheless dates are inserted in database in local time zone.
Is there any workaround for this. Any help will be appreciated. Thanks.
7 Answers, 1 is accepted
0
Alex
Top achievements
Rank 1
answered on 27 Oct 2010, 11:59 AM
Any advice from Telerik team?
Thanks.
Thanks.
0
Accepted
Hello Alex,
You need to set this option before you obtain an instance of the 'Database' i.e before the Database.Get call.
You can set the option by adding this node to the app.config file
<useUTCForAutoSets>True</useUTCForAutoSets>
Hope this helps.
Greetings,
Ady
the Telerik team
You need to set this option before you obtain an instance of the 'Database' i.e before the Database.Get call.
You can set the option by adding this node to the app.config file
<useUTCForAutoSets>True</useUTCForAutoSets>
Hope this helps.
Greetings,
Ady
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items
0
Alex
Top achievements
Rank 1
answered on 29 Oct 2010, 02:43 PM
Thanks! It works!
Just more detailed instruction. You need to put this node into <backendConfiguration> element.
So it should look something like this:
<backendconfiguration id="mssqlConfiguration" backend="mssql">
<dbNamegen.useModelNames>True</dbNamegen.useModelNames>
<mappingname>mssqlMapping</mappingname>
<useUTCForAutoSets>True</useUTCForAutoSets>
</backendconfiguration>
Just more detailed instruction. You need to put this node into <backendConfiguration> element.
So it should look something like this:
<backendconfiguration id="mssqlConfiguration" backend="mssql">
<dbNamegen.useModelNames>True</dbNamegen.useModelNames>
<mappingname>mssqlMapping</mappingname>
<useUTCForAutoSets>True</useUTCForAutoSets>
</backendconfiguration>
0
Sunita
Top achievements
Rank 1
answered on 28 Jul 2011, 02:20 PM
Hi ,
I tried this and it doesn't seem to be working. Is it
I am using version 2011 Q2 (2011.2.713.3) - ORM Classic (reverse map/forward map)
I tried this and it doesn't seem to be working. Is it
<
useUTCForAutoSets
>True</
useUTCForAutoSets
>
or
<
useUTCForAutoSetDates
>True</
useUTCForAutoSetDates
>
I am using version 2011 Q2 (2011.2.713.3) - ORM Classic (reverse map/forward map)
0
Hi Sunita,
It is 'useUTCForAutoSets'. There is no setting with the name 'useUTCForAutoSetDates'. Can you ensure that connectionId used to obtain the 'Database' instance is the same as specified in the app.config file and that this connection id resolves to the appropriate <backendConfiguration> element.
You can also send us your app.config file and I can verify it.
Kind regards,
Ady
the Telerik team
It is 'useUTCForAutoSets'. There is no setting with the name 'useUTCForAutoSetDates'. Can you ensure that connectionId used to obtain the 'Database' instance is the same as specified in the app.config file and that this connection id resolves to the appropriate <backendConfiguration> element.
You can also send us your app.config file and I can verify it.
Kind regards,
Ady
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>
0
Sunita
Top achievements
Rank 1
answered on 29 Jul 2011, 02:02 PM
Hi Ady,
I have sent you the app.config via a support ticket. Please let me know a solution.
Thanks,
Sunita
I have sent you the app.config via a support ticket. Please let me know a solution.
Thanks,
Sunita
0
Hi Sunita,
As replied to you via the support thread, the '<useUTCForAutoSets>true</useUTCForAutoSets>' setting applies to only those fields whose value is automatically set by the OpenAcess runtime via the 'Set field to current date during create/update' setting i.e fields with the following mapping in the app.config file
<extension key="autoset" value="..."/> where value can be 'created','modified' or 'both'.
Do let me know if your settings confirm to the above.
Regards,
Ady
the Telerik team
As replied to you via the support thread, the '<useUTCForAutoSets>true</useUTCForAutoSets>' setting applies to only those fields whose value is automatically set by the OpenAcess runtime via the 'Set field to current date during create/update' setting i.e fields with the following mapping in the app.config file
<extension key="autoset" value="..."/> where value can be 'created','modified' or 'both'.
Do let me know if your settings confirm to the above.
Regards,
Ady
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>