Search code examples
.netrepository-patternprovider-model

.net provider vs repository for building support for multiple video services


Trying to support multiple video providers.

  1. Internal video provider (User uploads video on app server and application plays it)
  2. Youtube provider (Gets everything from youtube and plays it by using embeded youtube video)
  3. Vimeo
  4. Some other provider

UI will enable user to select it's provider when selecting some video. Did anybody implemented something similar and do you recommend to use Provider model or Repository pattern for that?


Solution

  • It sounds like you are trying to force a pattern into your project.

    Me personally would make a VideoManager class that uses a strategy pattern to call a provider. The VideoManager would have functions like:

    1. GetVideo(string name)
    2. GetVideos()
    3. Search(string text)
    4. UploadVideo(File file)

    these functions would call the appropiate Provider, DAL or whatever you call it, that does the fetching of data. The you can write different video provider strategies.