I am new to WCF Services and can't get rid of this problem. For the next version of our web application I want to make use of WCF as webservice. Currently I am stuck with this problem:
To try WCF out I made 2 services: EmployeeService and AuthenticationService. I also made a datacontract Employee.
In AuthenticationService I use EmployeeService to get the logged Employee
Now in my client (ASP MVC Web) I add both Services as I need them both. But then when I try to use the object Employee I get the error :
Employee' is an ambiguous reference between 'IWA.Portal.AuthenticationService.Employee' and 'IWA.Portal.EmployeeService.Employee
The reason I want to make multiple services is to group them functionally. Example: Everything regarding employees will be under EmployeeService and everything regarding job will be under JobService.
How can I fix this or how should I structure my webservice?
Currently my webservice solution consists of :
- Project.DataContracts (Entities)
- Project.ServiceContracts (Interfaces)
- Project.Services (Services, NHibernate & Castle Windsor)
Any help is much appreciated! Thx
AuthenticationService
public class AuthenticationService : IAuthenticationService
{
private readonly IEmployeeService _employeeService;
public AuthenticationService(IEmployeeService employeeService)
{
_employeeService = employeeService;
}
public Employee Authenticate()
{
var employee = _employeeService.Get(1);
return employee;
}
}
Code in my client (Controller)
readonly EmployeeServiceClient _employeeService = new EmployeeServiceClient();
readonly AuthenticationServiceClient _authenticationService = new AuthenticationServiceClient();
Employee authedEmployee = _authenticationService.Authenticate();
Employee test = _employeeService.Get(827);