This article provides an example for creating a custom blob storage provider. This means creating a c# class that implements the IBlobProvider interface. This particular implementation (LocalDiskChunkBlobProvider) saves binary data to files of predefined size inside a folder in the file system, each file containing one chunk.
Please note that an optimal chunk size has not been tested for and the optimal size may very well depend on the particular system and its resources.
As a context is saved for every binary stream in the Files table, it is very well possible to set an individual chunk size for every stream. So, one could come up with varying chunk sizes for different size ranges if deemed necessary. Consequently, it is also possible to adjust the chunk size any time after deployment.
This particular implementation is not an enterprise level solution and comes as-is with no warranty whatsoever.
The 10-byte chunk size is merely for testing purposes, it is highly recommended to have it changed to at least several magnitudes higher (e.g., 64000 for ~64kB or 1000000 for ~1MB).
The following sample implementation stores binary data as chunks in the file system.
This sample reader stream helps serving chunks as a single stream from the file system.
This sample writer stream helps writing chunks to the file system.
Is something missing? See something that needs fixing? Propose a change here.