locked
Provider Model vs Repository Pattern RRS feed

  • Question

  • User1100692814 posted

    Hi all

    I am trying to understand the fundamental differences between the Provider Model and Repository Pattern.

    I have used the Provider Model in many many situations and am confident with it when designing applications. However, the more examples I encounter on the internet and asp.net evolution I keep coming across "Repository" Interfaces for classes that look like a Provider Model.

    I have dug around a bit but all I can see is that they kinda do the same thing, or closely overlap by enforcing an inheriting class to adhere to a "contract" of implemented / abstracted methods etc...is there more to it?

    With MVC and Web Forms, is there a preferred pattern?

    I am trying to move over to MVC and am teaching myself - so any help or pointers in the right direction would be great.

    Please help and explain in simple terms (avoid using jargon) -

    Thanks in advance

    David

    Friday, February 4, 2011 10:05 AM

Answers

  • User371668647 posted

    Traditionally, a Repository pattern applies to something existing on the boundary between the Domain objects and the actual source of the data that will reside in said Domain objects.

    The Provider Model, to me, is independent of the Repository pattern as it seems to be more about defining behaviors in a pluggable manner and isn't specifically tied to the boundary between the Domain objects and the source data.

    For example, you could have an EncryptionProvider that has Encrypt and Decrypt methods.  This then has different implementations (RSA, RSA64, etc.) that can be plugged in based on the Provider configuration.  In this case there would be no equivalent application of a Repository  pattern.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, February 8, 2011 12:33 PM