Page 1 of 1

Default values - Culture problem

Posted: Tue 11 Oct 2011 14:42
by dilbert
I have a datetime column which has
Default Value: 2999-12-31

This field is generated as follow:

Code: Select all

private System.DateTime _Valid_to = DateTime.Parse("12/31/2999 00:00:00");
Date is generated for US culture (probably based on Windows settings).

If I need an instance of this table on a thread with different culture I get an exception - for example:

Code: Select all

 v System.DateTimeParse.Parse(String s, DateTimeFormatInfo dtfi, DateTimeStyles styles)
   v System.DateTime.Parse(String s)
   v MyProject.DTO.ShopShipping..ctor() v C:\Projects\MyProject\MyProject\App_Data\DBSchema\MyProjectDB.Designer.cs:řádek 5132
   v lambda_method(Closure , c , Int32[] )
   v Devart.Data.Linq.Provider.h.c__DisplayClass5`1.a(c A_0)
   v Devart.Data.Linq.Provider.ObjectReader`1.g()
   v Devart.Data.Linq.Provider.EntityReader`3.b()
   v Devart.Data.Linq.Provider.ObjectReader`1.MoveNext()
   v Devart.Data.Linq.Provider.DataProvider.ReadQuery(CompiledQuery compiledQuery, IDbConnection con, f dataReader)
   v Devart.Data.Linq.Provider.DataProvider.ExecuteQuery(CompiledQuery compiledQuery, Object[] parentArgs, Object[] userArgs, Object lastResult)
Can you specify culture in generated code?

Posted: Wed 12 Oct 2011 16:17
by StanislavK
Thank you for the suggestion, we will consider changing this behaviour and inform you about the results.

Posted: Tue 08 Nov 2011 09:41
by dilbert
Thank you for adding CultureInfo.InvariantCulture parameter. It would be nice if you could also change
CultureInfo.InvariantCulture to System.Globalization.CultureInfo.InvariantCulture
or add
use System.Globalization;

(Now script generates error CultureInfo doesn't exist...)

Posted: Thu 10 Nov 2011 17:33
by StanislavK
Thank you for your assistance, we will post here when this is fixed.

Posted: Fri 09 Dec 2011 17:03
by StanislavK
We've fixed the problem with no namespace specified for the CultureInfo class in the generated code. This fix is available in the latest 4.2.85 build of Entity Developer (and in the new builds of data providers and LinqConnect). The new build can be downloaded from
http://www.devart.com/entitydeveloper/download.html
(the trial version) or from Registered Users' Area (for users with active subscription only).

For the detailed information about the fixes and improvements available in Entity Developer 4.2.85, please refer to
http://www.devart.com/forums/viewtopic.php?t=22845