Oracle Managed Dataacess EF6 custom edm mappings not applicable

We have many examples of the number (5.0) in our oracle db, for which the oracle provider defaults to Int16. This causes a problem because we can have a larger value than is allowed in the range of int16 for the same. Oracle recommends overriding edm mappings with user mappings (see Docs: https://docs.oracle.com/cd/E56485_01/win.121/e55744/entityDataTypeMapping.htm#ODPNT8300 ).

The problem I ran into, even with those user mappings in my asp.net mvc web.config project, override does not apply. I also created a completely new console application to test this and no luck.

Does anyone know how to make it work or have a better solution?

I probably should add this information,

  • VS 2015 EF6 Oracle Managed Data: Latest Version from NuGet
  • I know that the documents say that you can manually edit types in Table Mapping, but when you try to change them, it conflicts with the emd model and generates an error.
  • A workaround where you manually edit xml to remove precision in the short term, but every time you need an update from the database overwrites the changes. This is hard work, as I have over 40 hits in some tables that need to be edited

(below is the entry in web.config / app.config)

<oracle.manageddataaccess.client>
<version number="*">
  <edmMappings>
    <edmMapping dataType="number">
      <add name="bool" precision="1" />
      <add name="byte" precision="3" />
      <add name="int16" precision="4" />
      <add name="int32" precision="9" />
      <add name="int64" precision="18" />
    </edmMapping>
  </edmMappings>
  <dataSources>
    <dataSource alias="SampleDataSource" descriptor="(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=ORCL))) " />
  </dataSources>
</version>

+4
source share
2 answers

, , Fluent API . Code-First , . , .

  protected override void OnModelCreating(DbModelBuilder modelBuilder)
  {
        //Configure Column
        modelBuilder.Entity<Student>()
                    .Property(p => p.DateOfBirth)
                    .HasColumnName("DoB")
                    .HasColumnOrder(3)
                    .HasColumnType("datetime2");
  }

Fluent API:

entityframeworktutorial

msdn.microsoft

+1

EF 6? , edmx designer 7- , , , .

0

All Articles