Generic Repository Linq2Sql impedence mismatch problem?

Well to start with you'll need to change your Find signature to: T Find(Expression> query) LINQ to SQL needs to have the logic as an expression tree instead of a plain delegate, otherwise it can't work out how to translate it into SQL Beyond that, I'm afraid it's not terribly clear - it sounds like you're not using the same domain classes for your repository and LINQ to SQL. Is that right? That sounds like a potential problem; at the very least it's going to make life pretty tricky.

Well to start with you'll need to change your Find signature to: T Find(Expression> query); LINQ to SQL needs to have the logic as an expression tree instead of a plain delegate, otherwise it can't work out how to translate it into SQL. Beyond that, I'm afraid it's not terribly clear - it sounds like you're not using the same domain classes for your repository and LINQ to SQL. Is that right?

That sounds like a potential problem; at the very least it's going to make life pretty tricky.

Yes... I do not want to use the Linq2SQL classes as my domain objects because I may want to add behavior to my domain objects and I may also want to restrict the accessability of the members. – Michael Mann Aug 22 '09 at 18:18 Adding behaviour is easy: the generated classes are partial classes which means you can add your own behaviour in a separate file, but still in the same class. You can specify property accessibility in the dbml file.

– Jon Skeet Aug 22 '09 at 19:22 That certianly seems like a much simpler approach than transforming expression trees from one type into another. I will go with that approach and restrict visibility and access through interfaces. – Michael Mann Aug 23 '09 at 14:10.

Beyond that, I'm afraid it's not terribly clear - it sounds like you're not using the same domain classes for your repository and LINQ to SQL. Is that right? That sounds like a potential problem; at the very least it's going to make life pretty tricky.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions