Last post Aug 22, 2016 04:36 PM by Chris Zhao
Aug 20, 2016 09:36 PM|sbuggle|LINK
The error is stopping on this line.
thought it was entity related but the syntax may not be right... this was working then we updated edmx , please advise....
var userCompany = employeeRepository.GetById(query.CurrentUser).DepartmentNumber == 1 ? Company.BPC : Company.BEC
Aug 21, 2016 07:18 AM|vishwaraj1|LINK
it is giving some compile time error or runtime error. I error is compile time i think it is because of this line. employeeRepository.GetById(query.CurrentUser)
As suggested by method name GetById should accept some userid and you seems to be passing an object in this function.
If error is at runtime then you need to check valus in each object query.CurrentUser, Company which you are passing and check
if employeeRepository.GetById(query.CurrentUser) is returning single row only.
.SingleOrDefault after employeeRepository.GetById(query.CurrentUser) like
Aug 22, 2016 04:37 AM|RanjeetAulakh|LINK
I my opinion the problem is your table EmployeeTable's primary key is a complex primary key which is not a single column but may be combination of two or more columns.
And the employeeRepository.GetById() method is using EmployeeTableName.Find(id) method of entity framewrok and your table primary key is more than one column but you are passing only one value in GetById() so it says number of primary keys values passed
does not match the actual primary key after the edmx file update .
Aug 22, 2016 04:36 PM|Chris Zhao|LINK
If your database table doesn't specify a primary key field, your edmx model will assume each field is a key. So ensure your database and your entity model as saying the same thing.