Using VARCHAR2 instead of NVARCHAR2

Using VARCHAR2 instead of NVARCHAR2

Postby JoeRuspante » Sat 12 May 2012 10:29

Hi, I'm using CodeFirst and the last version of dotConnect.

I see that the string property are mapped as NCLOB / NVARCHAR2.
Is it possible to set the ModelBuilder for use CLOB/VARCHAR2 ?

I try setting the "Unicode" property on the connection string, but this doesn't seem to work.

Thank you in advance
JoeRuspante
 
Posts: 54
Joined: Mon 05 Jul 2010 23:08

Re: Using VARCHAR2 instead of NVARCHAR2

Postby Pinturiccio » Wed 16 May 2012 12:36

By default, strings in EF Code-First are considered as unicode and without explicit length. That's why it is of the NCLOB type. It would be VARCHAR2 if the [not unicode string] and [length < 4000 symbols] settings were specified in fluent (or attribute) mapping for a property.

Solution for the attribute mapping. If you indeed have the type in your database which differs from NCLOB, specify this explicitly (at least for the columns which take part in CASEs). Edited! E.g.: set the MaxLength(123) attribute if you have the NVARCHAR2(123) column in your database. Also turn off PropertyMaxLengthConvention from the Conventions collection in DbModelBuilder (this convention is used for unicode strings).

Solution for the fluent mapping. Set HasMaxLength(123) and IsUnicode(false) for the corresponding property. In this case there is no need to turn off PropertyMaxLengthConvention.
Pinturiccio
Devart Team
 
Posts: 1933
Joined: Wed 02 Nov 2011 09:44

Re: Using VARCHAR2 instead of NVARCHAR2

Postby JoeRuspante » Wed 16 May 2012 15:58

Sorry, but maybe I wasn't clear.

I found this solution (write an annotation for each property), but since ALL my string has to be threat in the same way (unicode = false), there is a place where I can set it once and not for all properties?
JoeRuspante
 
Posts: 54
Joined: Mon 05 Jul 2010 23:08

Re: Using VARCHAR2 instead of NVARCHAR2

Postby Pinturiccio » Thu 17 May 2012 08:03

We are planning to implement additional settings for the Entity Framework provider soon, they will allow performing string types mapping customization easily and in one place. But this functionality will not be included in the nearest builds.
Pinturiccio
Devart Team
 
Posts: 1933
Joined: Wed 02 Nov 2011 09:44

Re: Using VARCHAR2 instead of NVARCHAR2

Postby JoeRuspante » Fri 18 May 2012 09:38

Thank you a lot.
For now we will set the configuration for each property
JoeRuspante
 
Posts: 54
Joined: Mon 05 Jul 2010 23:08

Re: Using VARCHAR2 instead of NVARCHAR2

Postby Shalex » Thu 19 Jul 2012 11:10

New version of dotConnect for Oracle 7.1 is released!
It can be downloaded from http://www.devart.com/dotconnect/oracle/download.html (trial version) or from Registered Users' Area (for users with active subscription only).
For more information, please refer to http://forums.devart.com/viewtopic.php?f=1&t=24522 .

This version includes the config.CodeFirstOptions.UseNonUnicodeStrings configuration option (default value is False) to treat string properties without an explicitly specified server data type as non-unicode.
Shalex
Devart Team
 
Posts: 7533
Joined: Thu 14 Aug 2008 12:44

Re: Using VARCHAR2 instead of NVARCHAR2

Postby JoeRuspante » Fri 03 Aug 2012 12:45

Thank you a lot!
JoeRuspante
 
Posts: 54
Joined: Mon 05 Jul 2010 23:08


Return to dotConnect for Oracle