Click here to Skip to main content
15,887,267 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
i created library project. Inside library project created one class and one interface.Interface has some methods. Class has some properties. On same solution i created another library project. I added entity framework and one class. This class has inherit previous project interface file. And when i implement the interface members in another class file using entity framework. It gives an error
Quote:

Error CS1503 Argument 1: cannot convert from 'CRUDApp.Core.EmployeeRegistration' to 'CRUDApp.Infrastructure.Employee'


What I have tried:

C#
void Add(EmployeeRegistration employeeRegistration);
Interface Member This Member can implemented in another class.
EmployeeRegistration 
is a class contains some Properties
C#
public void Add(EmployeeRegistration employeeRegistration)
       {
           employeeEntities.Employees.Add(employeeRegistration);
           employeeEntities.SaveChanges();
       }
Posted
Updated 1-Jun-17 5:30am

1 solution

You are trying to add an EmployeeRegistration class to a collection of Employee objects. Employees.Add needs you to pass an Employee object but you are passing EmployeeRegistration. If you want to add to the Employees you need to add an Employee object.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900