StorageProvider Requirements

Nov 16, 2007 at 9:33 AM
I'm ignoring the technical implementation issues with this discussion - surfice to say that it will follow the usual standard patterns. What I wanted to get down was the "requirements" for a model.

1. Must support Local storage - that is storage in the same location as the blog engine is running (ie: App_Data/files/photos)
2. Must be extendible for different storage mediums
3. Must support differnet providers for different types of media
4 The BE media object (eg: photo) should not be aware of where the file is located - this is the providers responsibility

Media is the generic term for something like a Photo, Video, Powerpoint presentation, File, etc.

Storage Mediums
Local Storage is the most obvious and the available types will differ by file type. Other storage locations are:
- Flickr
- YouTube
- Windows Live Photos
- Windows Live Drive
- XDrive
- etc,etc,etc

Awareness and Rendering
Ok, I get vague at this point so I'm going to use the Photo object as an example. A photo is a set of information that represents a real world image. In BE, we store enough meta-data (title, description, tags, etc) to allow us to process it locally without knowing where the file is - the worst case for us is that we fail to render an image to the screen but the core code continues to operate as we expect.

The controls that render the photo to the response stream should not assume anything about the actual location of the image (ie: the <img src= tag).
I believe that photo should expose a property that the control can use. This property will return the correct XHTML to allow accurate rendering.

Therefore, the provider must make the correctly formatted XHTML available using the information in the Photo and it's knowledge of the storage mechanism.

The Photo must store information given to it by the provider to enable the provider to create the XHTML.

The local storage provider will assume the use of a handler like photo.axd when rendering the XHTML.