-
-
Notifications
You must be signed in to change notification settings - Fork 72
Getting Started
To get started, add the main FluentStorage Nuget package into your .NET application.
Then add the packages you need as per the cloud storage providers you want to use.
All of the API methods are defined in the IStore and IQueue interfaces.
However Azure Blob Storage supports blob leasing, shared access signatures, and implements IAzureBlobStorage that extends the functionality further.
All the storage implementations can be created directly using factory API in the factory classes.
You can also use connection strings to create blob storage instances. Connection strings are often useful if you want to completely abstract yourself from the underlying implementation. Please read the appropriate implementation details for connection string details.
For instance, to create an instance of Azure Blob Storage provider you could write:
IStore storage = StorageFactory.FromConnectionString("azure.blobs://...parameters...");In this example we create an Azure blob storage, then upload and download a text string to a blob.
IStore storage = AzureBlobStorage.FromSharedKey("storage name","storage key");
// upload it
await store.SetText("mycontainer/someid", "test content");
// download it
string content = await store.GetText("mycontainer/someid");In addition, you can use these in-built providers:
| Factory method | Purpose |
|---|---|
StorageFactory.FromConnectionString |
Creates a bucket storage instance from a connection string |
StorageFactory.Disk |
Creates a storage for a specific disk directory |
StorageFactory.InMemory |
Creates a storage which stores everything in memory |
To construct storage classes, you need to use the factory methods as per the provider.
In addition, you can use these in-built providers:
| Factory method | Purpose |
|---|---|
QueueFactory.FromConnectionString |
Creates a message publisher from connection string |
QueueFactory.InMemory |
Creates a message publisher which holds messages in memory |
QueueFactory.Disk |
Creates a message publisher that uses local disk directory as a backing store. |