Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/336.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# Oracle数字转换为.Net十进制_C#_Oracle_Entity Framework 6_Ef Code First - Fatal编程技术网

C# Oracle数字转换为.Net十进制

C# Oracle数字转换为.Net十进制,c#,oracle,entity-framework-6,ef-code-first,C#,Oracle,Entity Framework 6,Ef Code First,我正在将实体框架项目映射到现有的Oracle数据库。我有一门课: public class Order { [Key] public string OrderNo {get;set;} // Oracle type VARCHAR2(100) public decimal Cost {get;set;} // Oracle type NUMBER (no precision) } public DbSet<Order> Orders {get;set;} 返回

我正在将实体框架项目映射到现有的Oracle数据库。我有一门课:

public class Order 
{
   [Key]
   public string OrderNo {get;set;} // Oracle type VARCHAR2(100)
   public decimal Cost {get;set;} // Oracle type NUMBER (no precision)
}

public DbSet<Order> Orders {get;set;}
返回错误
指定的强制转换无效。这似乎是由于“成本”列中的十进制值非常大造成的。我已尝试在实体上设置以下属性:

[Column("ROUND(COST,2)"]
public decimal Cost {get;set;}
这会导致生成的SQL异常:ORA-00904:“Extent1”。“ROUND(COST,2)”:无效标识符。我希望它生成
轮(“Extent1.COST,2)

有没有办法强制数据库将列转换为SQL语句的一部分

[Column("ROUND(COST,2)"]
public decimal Cost {get;set;}