Hi, Firstly, I want to apologize for my English, not my strongest side.
To the question. In my current project, I have interfaces to my entities so I can use Subsonic attributes at my head entites and I want to be able to seamlessly switch O/R mapper in the future. Anyway, I get an error when I try to use my interfaces and SimpleRepositorys classes like Single<>, All<> and so on. I know why I get the error message but I need help to find a way to get around it. Error message:
System.InvalidCastException: Unable to cast object of type 'SubSonic.DomainObjects.User' to type 'Core.DomainObjects.IUser'.
Code:
public IUser FindById(int id) {
var user = _repository.Single<User>(x => x.Id == id);
return (IUser)user;
}
As you can see I have tried to make User to IUser order to work when I want to add data, but without success. What can I do to make this work?
Thank you,
Timmie