asp.net core 6 EF scaffolding

Born2Achieve 21 Reputation points
2022-12-15T02:48:51.417+00:00

Hello,

I am creating Asp.net core 6 web api with oracle 19 as backend. i am using DB first approach and create model object from DB table. i used the below syntax,

scaffold-dbcontext "Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=TestDB.Test.com)(PORT=1717))(CONNECT_DATA=(SERVICE_NAME=TestDB)));User Id=usename;Password=password;Persist Security Info=True;Connection Lifetime=100000;" Oracle.EntityFrameworkCore -o ModelFolder -f  

Note : i removed the secured data and gave dummy data on the above code. I was able to generate the model from my backend. but having some issues with DB type. i am trying to call the EF query to get the data and facing cast issue. one of the table column is datatype is Number(3) and model got created as Byte?. when it try to bind the entity result, it gives me specified cast is not valid. its expecting Int. am not sure how to solve the issue. i should not be modified the auto generated model property to int. not sure is this ongoing issue with asp.net core with oracle. requesting any suggestion to solve this error.

Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
697 questions
{count} votes