Page 1 of 1
Using VARCHAR2 instead of NVARCHAR2
Posted: Sat 12 May 2012 10:29
by JoeRuspante
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
Re: Using VARCHAR2 instead of NVARCHAR2
Posted: Wed 16 May 2012 12:36
by Pinturiccio
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.
Re: Using VARCHAR2 instead of NVARCHAR2
Posted: Wed 16 May 2012 15:58
by JoeRuspante
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?
Re: Using VARCHAR2 instead of NVARCHAR2
Posted: Thu 17 May 2012 08:03
by Pinturiccio
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.
Re: Using VARCHAR2 instead of NVARCHAR2
Posted: Fri 18 May 2012 09:38
by JoeRuspante
Thank you a lot.
For now we will set the configuration for each property
Re: Using VARCHAR2 instead of NVARCHAR2
Posted: Thu 19 Jul 2012 11:10
by Shalex
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.
Re: Using VARCHAR2 instead of NVARCHAR2
Posted: Fri 03 Aug 2012 12:45
by JoeRuspante
Thank you a lot!