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;
public class Document(Session session) : BaseObject(session), IFileAttachment
{
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>");
}
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;
public class Document(Session session) : BaseObject(session), IFileAttachment
{
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>");
}