For Code-First Development with Entity Framework 4.2, I get this following error while saving data.
ORA-01482: unsupported character set
ORA-06512: at line 4
I guess this is something doing with the datatype. Is there a way to specify specific datatype such as varchar(32) at the entity level.
Thanks,
ORA-01482: unsupported character set
Data Type Specification for Database Generation
I think the question we are asking is how for database generation do you specify that a string is a CHAR(32) or NVARCHAR(20) or VARCHAR(4) when using Code First?
Can this be done via DataAnnotation attributes or the fluent API? If so how?
We use the current version (6.60.283).
Can this be done via DataAnnotation attributes or the fluent API? If so how?
We use the current version (6.60.283).
By default, strings in EF Code-First are considered as unicode and without explicit length. That's why they are of NCLOB type. They would be VARCHAR2 if the [not unicode string] and [length < 4000 symbols] settings were specified in fluent (or attribute) mapping for a particular property.
Solution for the attribute mapping. If you indeed have the type in your database which differs from NCLOB, specify this explicitly. E.g.: set the MaxLength(123) attribute if you have the VARCHAR2(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.
Solution for the attribute mapping. If you indeed have the type in your database which differs from NCLOB, specify this explicitly. E.g.: set the MaxLength(123) attribute if you have the VARCHAR2(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.