I'm using EF with Oracle, and I have a table with a nullable float column. When I map this table, the column shows up as a Nullable Decimal.
In this table I inserted a row, in the nullable column, I inserted this number:
0.0237786257912282
Then, I call the table with LINQ:
lList = db.EntTest.ToList();
Doing that, Visual Studio throws a
System.InvalidCastException
If I update the record, removing the number and them I call the list again, it works.
Any suggestions?
As StevePy says, using
HasPrecision
on OnModelCreating function in the Context.cs works, for example:
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
modelBuilder.Entity<EntTest>().Property(p => p.NUMBER).HasPrecision(15,30);
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.