Page 1 of 1

SQL + Oracle - smallint / Int16 / Number(*,0)

Posted: Fri 19 Dec 2008 11:13
by tmyklebust
Hi all

I'm working on a utility application that is going to extend / be a supplement to a third party product. My application is going to communicate directly with the database and I have decided to use Entity Framework as ORM. Since we need to support both SQL and Oracle, I have made a shared conseptual model and made one set of .msl and .ssdl for each database type.

There are some columns specified as smallint in SQL. These are mapped to Int16 in .NET. My problem is that I cannot get these columns to work with the corresponding number type in Oracle. I'm not really familiar with Oracle, but for me it looks like the column types are slightly different configured compared to what they are in SQL. Columns that are smallint in SQL are NUMBER(*,0) in Oracle, and the NUMBER(*,0) is also used where int is used in SQL. Since I am not owning the database schema I cannot change it.

I have tried different column types in the Oracle .ssdl file. The only that will let me use the model is:
The problem is when I try to do an update against the database, I get the following exception:

Code: Select all

The specified value is not an instance of type 'Edm.Decimal'
Parameter name: value
Is there any way I can make the DevArt Oracle Provider accept this combination? Or can I somehow hook in somewhere and convert/cast the value myself? I know that the data actually stored in the column is never going to be out of the Int16 bounds, so it should really not be any problem to just cast the value.

I have read through the forums here and tried any hint I have found. http://www.devart.com/forums/viewtopic.php?t=13175 is a pretty similar issue, but it does use int / Int32 and not short / Int16.

I would appreciate any feedback.

Terje Myklebust

Posted: Fri 19 Dec 2008 13:24
by AndreyR
Try to change mapping for the smallint field manually using XML Editor, like this: in SSDL part and to in CSDL part of your generated .edmx file

Posted: Fri 19 Dec 2008 14:24
by tmyklebust
Then I get this error message:

The specified value is not an instance of type 'Edm.Int32'
Parameter name: value

Actually this is was I tried first - I have been playing around with all the kind of combinations that I can think of.

Posted: Mon 22 Dec 2008 10:04
by AndreyR
The problem is fixed. Manual mapping of the int16 EDM type will be available in the next build.

Posted: Tue 06 Jan 2009 08:13
by tmyklebust
When is this build available for download? I am still evaluating your product and will buy it as soon as I have verified that everything is working correctly. My client is waiting for the software with Oracle support, so I would appreciate a quick build. Thanks.

Posted: Tue 06 Jan 2009 08:37
by AndreyR
We are planning to release the next build this week.