1
votes

I use oracle managed data access.

Config:

<configSections>
    <section name="oracle.manageddataaccess.client" type="OracleInternal.Common.ODPMSectionHandler, Oracle.ManagedDataAccess, Version=4.121.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342" />  
</configSections>

<system.data>
     <DbProviderFactories>
     <!-- Remove in case this is already defined in machine.config -->
        <remove invariant="Oracle.DataAccess.Client" />
        <remove invariant="Oracle.ManagedDataAccess.Client" />
        <add name="ODP.NET, Managed Driver" invariant="Oracle.ManagedDataAccess.Client" description="Oracle Data Provider for .NET, Managed Driver" type="Oracle.ManagedDataAccess.Client.OracleClientFactory, Oracle.ManagedDataAccess, Version=4.121.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342" />
      </DbProviderFactories>
</system.data>

<oracle.manageddataaccess.client>
    <version number="*">
      <edmMappings>
        <edmMapping dataType="number">
            <add name="bool" precision="1"/>
            <add name="byte" precision="2" />
            <add name="int16" precision="5" />
        </edmMapping>
      </edmMappings>
    </version>
</oracle.manageddataaccess.client>

<add name="ОплПересчетDataContext" connectionString="Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=vm-amm0)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=AMM)));User Id=TEST;Password=TEST;" providerName="Oracle.ManagedDataAccess.Client"/>

I get error:

error 2019: Member Mapping specified is not valid. The type"Edm.Boolean[Nullable=True,DefaultValue=]" of member "Исключена" in type "Galaktika.PRM.WOM.EntityFramework.ОперацииWOM.СпецификацияОперация" is not compatible with"OracleEFProvider.number[Nullable=True,DefaultValue=,Precision=38,Scale=0]" of member "ИСКЛЮЧЕНА" in type "CodeFirstDatabaseSchema.СпецификацияОперация".

What did i wrong?

1

1 Answers

0
votes

I was trying to map bool to a numeric(1,0) using oracle managed data access (Oracle 11g Express Edition 11.2.0.2.0) without any luck. So at the end I changed the property from:

public bool IsActive { get; set; }

to:

public Int16 IsActive { get; set; }

This is the default mapping on that mentioned driver, then you can check the value of IsActive like object.IsActive == 1. You can also change the type to string and do something like:

object.IsActive == "YES"