Default values - Culture problem

Discussion of open issues, suggestions and bugs regarding Entity Developer - ORM modeling and code generation tool
Post Reply
dilbert
Posts: 68
Joined: Tue 28 Apr 2009 10:11

Default values - Culture problem

Post by dilbert » Tue 11 Oct 2011 14:42

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?

StanislavK
Devart Team
Posts: 1710
Joined: Thu 03 Dec 2009 10:48

Post by StanislavK » Wed 12 Oct 2011 16:17

Thank you for the suggestion, we will consider changing this behaviour and inform you about the results.

dilbert
Posts: 68
Joined: Tue 28 Apr 2009 10:11

Post by dilbert » Tue 08 Nov 2011 09:41

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...)

StanislavK
Devart Team
Posts: 1710
Joined: Thu 03 Dec 2009 10:48

Post by StanislavK » Thu 10 Nov 2011 17:33

Thank you for your assistance, we will post here when this is fixed.

StanislavK
Devart Team
Posts: 1710
Joined: Thu 03 Dec 2009 10:48

Post by StanislavK » Fri 09 Dec 2011 17:03

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

Post Reply