Has anyone found a good way to map a NUMBER column to to System.Decimal in .Net and EF and make it work for numbers with lots of dp's (without just setting everything to System.Double
i.e.
public decimal VALUE_ { get; set; } will throw "Specified cast is not valid." on numbers with many decimal places...
[Column("VALUE_")]
public double VALUE_Temp { get; set; }
[NotMapped]
public decimal VALUE_
{
get
{
return new decimal(VALUE_Temp);
}
set
{
VALUE_Temp = (double)value;
}
}
works but is a rubbish solution..
System.InvalidCastException was unhandled
HResult=-2147467262
Message=Specified cast is not valid.
Source=Oracle.ManagedDataAccess
StackTrace:
at Oracle.ManagedDataAccess.Client.OracleDataReader.GetDecimal(Int32 i)
at Oracle.ManagedDataAccess.Client.OracleDataReader.GetValue(Int32 i)
and
protected override void OnModelCreating(System.Data.Entity.DbModelBuilder modelBuilder)
{
modelBuilder.Entity<myEntity>().Property(o => o.VALUE_).HasPrecision(28, 24);
}
doesn't help//