1

I am working on a .Net Core class library project.I use Devart entity framework core to connect oracle database. I use devart's oracle mapping methods at link http://blog.devart.com/entity-framework-core-1-entity-framework-7-support.html

I can get datas successfully when type of columns of table is string. But, if type of columns of table is decimal, complier gives me error below:

Severity    Code    Description Project File    Line    Suppression State
Error   CS0452  The type 'decimal?' must be a reference type in order to use it as parameter 'TEntity' in the generic type or method 'OraclePropertyBuilderExtensions.ForOracleHasColumnName<TEntity>(PropertyBuilder<TEntity>, string)'.

my mapping function is:

 private void MyTableMapping(ModelBuilder modelBuilder)
        {
            modelBuilder.Entity<MyTable>().ForOracleToTable(@"MyTable");
            modelBuilder.Entity<MyTable>().Property<string>(x => x.SIRKETID).ForOracleHasColumnName(@"SIRKET_ID").ForOracleHasColumnType(@"VARCHAR2").ValueGeneratedNever().HasMaxLength(2);//this  line is ok
            modelBuilder.Entity<MyTable>().Property<decimal>(x => x.ID).ForOracleHasColumnName(@"ID").ForOracleHasColumnType(@"NUMBER").IsRequired().ValueGeneratedOnAdd();//this  line gives error
         }

Sorry for my low English.

mfg
  • 23
  • 7

1 Answers1

0

Thank you for your report. We have reproduced the issue and will notify you when it is fixed.

As a workaround, please use:

optionsBuilder.UseOracle("oracle_connection_string");
modelBuilder.Entity<MyTable>().Property<decimal>(x => x.ID).HasColumnName(@"ID").HasColumnType(@"NUMBER").IsRequired().ValueGeneratedOnAdd();
Devart
  • 119,203
  • 23
  • 166
  • 186
  • The bug with using the ForOracleHasColumnName and ForOracleHasColumnType modelBuilder methods with the value-type properties in EF Core is fixed: http://forums.devart.com/viewtopic.php?f=1&t=35436. – Devart May 26 '17 at 17:28
  • Thanks for your interests – mfg Jul 31 '18 at 10:16