I want to use my own Model classes in a repository pattern. I don't want to be dependent on the classes that LINQ to SQL generates. Is that viable? How do I handle the Where
(and other selections when its a Func<MyModel, bool>
but LINQ to SQL wants a Func<LinqToSqlModel, bool>
?
I've devised this, but I might be starting to over engineer it...
interface IModelConverter<T1, T2>
{
T2 Convert(T1 item);
T1 Convert(T2 item);
}
Is this too much redirection?
All I want to do is have a repository of MyModel
that is able to have any implementation in the back end whether LINQ to SQL, LINQ to Enities, etc.
Does anyone have any resources?