Sushant Torankar

Sushant Torankar

  • 1.9k
  • 92
  • 2.8k

sql Invalid column in core web api

Jun 15 2022 9:03 PM

hello,

I am using asp.net core web api  and entity framework core.

I have two tables LogsMaster with columns Id, title, Description and PermissionMaster with columns Id, LogId and ContactId

When Log details is saved in LogsMaster, along with it I am saving LogId(Primary Id column of LogsMaster) and ContactId in PermissionMaster table. So one LogId can have multiple ContactId in PermissionMaster table.

Using following property in LogsMaster table to save ContactId List
public IEnumerable<ContactsMaster> Contacts { get; set; }

In GET request of Contact api, I am getting 500 error code and error is  : 

Exception: Invalid column name 'LogsMasterId' 

I don't have 'LogsMasterId' column in my project or in database, so I am not sure from where that colmumn is coming from ?

Maybe because of One-to-many table relation, I am  not using Primary-foreign key relationship to any table

plz help me with this ?

thank you

 


Answers (4)