EFCore Scaffold-DbContext SqlClient.SqlException (0x80131904): Invalid column name


I am using entity framework core to connect to my existing SQL DB that is used by other applications as well and therefor want to use the scaffolding to create my models from said DB. I have used it time and time again to create my models from the existing DB but this time I am getting this error:

Microsoft.Data.SqlClient.SqlException (0x80131904): Invalid column name 'has_filter'. Invalid column name 'filter_definition'.

The command I am running is trying to load just one view that does not contain any of the columns mentioned in the error.

The command I am running in the Package Manager Console is:

Scaffold-DbContext -connection "Data Source=DBSRV;Initial Catalog=DB;User ID=usr;Password=psw" Microsoft.EntityFrameworkCore.SqlServer -Project "LibProject" -OutputDir Models -Tables "VIEW" -force

The error is thrown only when I try to use the scaffolding on this DB, if I use it in other DBs it works flawlessly.

Why am I getting this error? Can someone point me at what I need to check to fix this?

asked on Stack Overflow Sep 15, 2020 by guster47

0 Answers

Nobody has answered this question yet.

User contributions licensed under CC BY-SA 3.0