jparram
jparram

Reputation: 804

ORM agnostic patterns

I am looking for a discussion on the use of ORMs in fashion where one could swap out the ORM you are using with a minimal impact on the rest of the system.

I guess if you were using MVP, your view and presenter would have no idea (no references) to whatever ORM you are using. I think the best that I came up with is a Service class that uses some IRepository. And the concrete repository returns DTOs to the service class. You would have a concrete repository implementation for each ORM that you use. I would also ask how you would manage the mappings between the ORM objects/entities and the DTOs efficiently.

I guess I would like to free the majority of the application from depending on a specific ORM.

Does anyone have a link to a blog/whitepaper discussing this topic?

Upvotes: 2

Views: 776

Answers (1)

Justin Niessner
Justin Niessner

Reputation: 245429

Like you said, hiding the ORM used is a perfect job for the Repository Pattern.

Upvotes: 2

Related Questions