repository pattern - IRepository - Entity implementation -


i'm using repository , unitofwork pattern in order mantain decoupled code , achieve simple way test application.

the inner implementation use entityframerowk db first , works fine.

tomorrow, might want use other concrete repository implementation such file system rather database, repository method find, or delete difficult accomplish, because entities doesn't implement primary-foreing keys , on. implies entity research on repository should looks fields matching t object parameter.

so, practice enforce entities interface implementation? instance:

is there available example or tutorial this?

some repository method find, or delete difficult accomplish, because entities doesn't implement primary-foreing keys , on. implies entity research on repository should looks fields matching t object parameter.

that's how not implement repository. repository interface (contract) should ignorant of underlying implementation details such entity framework. way can have different implementation of repository , achieve seaparation of concerns. also, testing code uses repository should not involve ef or db @ all.


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -