FileAttachments - Azure Blob Storage

Overview

Supported Platforms:

  • WinForms
  • WebForms
  • Blazor

Supported ORMs:

  • XPO
  • EF Core

Upload file attachments to Azure Blob Storage implementing the IFileAttachment interface on your business objects and using the AzureBlobStorageFileAttachmentProcessor.

using LlamachantFramework.FileAttachments.AzureBlobStorage;
using LlamachantFramework.Module.Interfaces;

[FileAttachment(nameof(FileData))]
[DefaultProperty(nameof(FileName))]
public class Document(Session session) : BaseObject(session), IFileAttachment
{
    public IFileData FileData { get => this; set { } }
    
    private Client _Client;
    [Association]
    public Client Client
    {
        get { return _Client; }
        set { SetPropertyValue<Client>(nameof(Client), ref _Client, value); }
    }
    
    private string _StorageLocation;
    [Size(1024)]
    public string StorageLocation
    {
        get { return _StorageLocation; }
        set { SetPropertyValue<string>(nameof(StorageLocation), ref _StorageLocation, value); }
    }
    
    public string CalculateStorageLocation() => $@"Client Files\{DateTime.Today.Year}\";
    
    #region IFileData
    
    private string _FileName;
    public string FileName
    {
        get { return _FileName; }
        set { SetPropertyValue<string>(nameof(FileName), ref _FileName, value); }
    }
    
    private int _Size;
    public int Size
    {
        get { return _Size; }
        set { SetPropertyValue<int>(nameof(Size), ref _Size, value); }
    }
    
    public void LoadFromStream(string filename, Stream stream)
    {
        GetStorageProcessor().LoadFromStream(filename, stream, this);
    }
    
    public void SaveToStream(Stream stream)
    {
        GetStorageProcessor().SaveToStream(stream, this);
    }
    
    public void Clear()
    {
        GetStorageProcessor().Clear(this);
    }
    
    #endregion
    
    private AzureBlobStorageFileAttachmentProcessor GetStorageProcessor() => new AzureBlobStorageFileAttachmentProcessor("<your azure blob storage connection string>", "<your azure container name>");
}

Supported Platforms:

  • WinForms
  • WebForms
  • Blazor

Supported ORMs:

  • XPO
  • EF Core

Upload file attachments to Azure Blob Storage implementing the IFileAttachment interface on your business objects and using the AzureBlobStorageFileAttachmentProcessor.

using LlamachantFramework.FileAttachments.AzureBlobStorage;
using LlamachantFramework.Module.Interfaces;

Supported Platforms:

- WinForms
- WebForms
- Blazor

Supported ORMs:

- XPO
- EF Core

```csharp
using LlamachantFramework.FileAttachments.AzureBlobStorage;
using LlamachantFramework.Module.Interfaces;