NumberMappings from NUMBER(1) Oracle type to Int16 .NET type

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
J.Gall
Posts: 7
Joined: Fri 21 Nov 2014 08:41

NumberMappings from NUMBER(1) Oracle type to Int16 .NET type

Post by J.Gall » Fri 06 Feb 2015 12:32

Hi,

I have try to use number mapping settings for one column (TEST_NUMB1 in example) in our Oracle12 Database. I was map NUMBER(1) oracle type to Int16 .NET type. But mapping is allways generated with bool .NET type.

See:
http://blog.devart.com/new-features-of- ... erMappings

This configuration can I see in *.edps file:

Code: Select all

<Connection ConnectionString="User Id=54353N;Password=***;Server=TEST;Direct=True;Sid=ORCL12c;Persist Security Info=True;Number Mappings=(NUMBER,1,1,System.Int16)" Provider="Devart.Data.Oracle" />
Test Table:

Code: Select all

CREATE TABLE IDENTITY_TEST_TAB
(
  ID           NUMBER GENERATED ALWAYS AS IDENTITY,
  DESCRIPTION  VARCHAR2(30 BYTE),
  TEST_NUMB1   NUMBER(1),
  TEST_VCHAR1  VARCHAR2(1)
);
Generated content:

Code: Select all

<!-- SSDL content -->
    <edmx:StorageModels>
      <Schema Namespace="MyModel.Store" Alias="Self" Provider="Devart.Data.Oracle" ProviderManifestToken="Oracle, 12.1.0.1" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" xmlns:devart="http://devart.com/schemas/edml/StorageSchemaExtensions/1.0" xmlns="http://schemas.microsoft.com/ado/2009/11/edm/ssdl">
        <EntityContainer Name="MyEntitiesStoreContainer">
          <EntitySet Name="IDENTITY_TEST_TABs" EntityType="MyModel.Store.IDENTITY_TEST_TAB" store:Type="Tables" Schema="54353N" Table="IDENTITY_TEST_TAB" />
        </EntityContainer>
        <EntityType Name="IDENTITY_TEST_TAB">
          <Key>
            <PropertyRef Name="ID" />
          </Key>
          <Property Name="ID" Type="decimal" Nullable="false" StoreGeneratedPattern="Identity" />
          <Property Name="DESCRIPTION" Type="VARCHAR2" MaxLength="30" />
          <Property Name="TEST_NUMB1" Type="bool" />
          <Property Name="TEST_VCHAR1" Type="VARCHAR2" MaxLength="1" />
        </EntityType>
      </Schema>
    </edmx:StorageModels>
Is something wrong in my settings?
Thank’s for any idea!

Best regards
Jaroslav

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: NumberMappings from NUMBER(1) Oracle type to Int16 .NET type

Post by Shalex » Mon 09 Feb 2015 10:00

You are using Entity Developer (*.edml), aren't you? Please change the default mapping via Tools > Entity Developer> Options > Servers Options > Oracle. Does this help?

Just to clarify the designed behaviour:
a) the default type mapping for the Entity Framework feature in dotConnect for Oracle is available at http://www.devart.com/dotconnect/oracle ... pping.html
b) the Database First default mapping for the newly created models can be customized via:
-> the Tools > Entity Developer> Options > Servers Options > Oracle menu (applied only for Entity Developer, *.edml)
-> the Number Mappings connection string parameter (applied only for EDM Wizard, *.edmx)
c) if you switch to Model-First approach, be aware of the following option which allows applying default mapping in SSDL automatically: Model Settings > Synchronization > Mapping > "Enable automatic synchronization of storage part and mapping of the model with its conceptual part"

J.Gall
Posts: 7
Joined: Fri 21 Nov 2014 08:41

Re: NumberMappings from NUMBER(1) Oracle type to Int16 .NET type

Post by J.Gall » Mon 09 Feb 2015 13:11

Hi Shalex,
b) the Database First default mapping for the newly created models can be customized via:
-> the Tools > Entity Developer> Options > Servers Options > Oracle menu (applied only for Entity Developer, *.edml)
This works! Thank you.
-> the Number Mappings connection string parameter (applied only for EDM Wizard, *.edmx)
I have try this with Entity Framework (EDM Wizard) directly with this result:
1. If I set "Number Mappings=(NUMBER,1,1,System.Int32)" parameter for columns defined as NUMBER(1) in Oracle DB => has no effect for generating. Mapping was allways generated with .NET type "bool".
2. If I set "Number Mappings=(INTEGER,1,1,System.Int32)" parameter for columns defined as NUMBER(1) in Oracle DB => generated with correctly mapping with .NET Type "int"!

Thank’s for you help!

best regards
Jaroslav

Post Reply