Tildom.Services
8.0.0
Prefix Reserved
See the version list below for details.
dotnet add package Tildom.Services --version 8.0.0
NuGet\Install-Package Tildom.Services -Version 8.0.0
<PackageReference Include="Tildom.Services" Version="8.0.0" />
paket add Tildom.Services --version 8.0.0
#r "nuget: Tildom.Services, 8.0.0"
// Install Tildom.Services as a Cake Addin #addin nuget:?package=Tildom.Services&version=8.0.0 // Install Tildom.Services as a Cake Tool #tool nuget:?package=Tildom.Services&version=8.0.0
Tildom.Services
Tildom.Services is a .NET package that provides services and wrappers for working with application state and Azure services, specifically Blob Storage and Azure Form Recognizer. The package includes utility classes to manage state in Blazor applications and interact with Azure Blob Storage and Azure Form Recognizer.
Installation
To install Tildom.Services, run the following command in the NuGet Package Manager Console:
Install-Package Tildom.Services
Features
- AppState: A class to manage and notify changes in application state, especially useful in Blazor applications.
- AzureBlobStorageWrapper: A class to simplify interaction with Azure Blob Storage.
- AzureFormRecognizerWrapper: A class to simplify interaction with Azure Form Recognizer services.
Usage
1. AppState
The AppState
class implements INotifyPropertyChanged
and is designed to manage global state in Blazor applications. It can be consumed using the CascadingValue
component.
Example in Blazor:
@page "/"
@using Tildom.Services
@inject AppState AppState
<CascadingValue Value="AppState" IsFixed="true">
<StatusBar />
</CascadingValue>
@code {
protected override void OnInitialized() {
AppState.Message = "Hello from the AppState!";
}
}
In the StatusBar
component:
@code {
[CascadingParameter] public AppState? AppState { get; set; }
protected override void OnInitialized() {
if (AppState != null) {
AppState.PropertyChanged += OnAppStateChanged;
}
}
private void OnAppStateChanged(object? sender, PropertyChangedEventArgs e) {
if (e.PropertyName == nameof(AppState.Message)) {
StateHasChanged();
}
}
}
2. AzureBlobStorageWrapper
The AzureBlobStorageWrapper
class wraps around the BlobServiceClient
provided by the Azure SDK, making it easier to initialize and use Blob Storage in your application.
Example usage:
using Tildom.Services;
using Azure.Storage.Blobs;
var blobStorageWrapper = new AzureBlobStorageWrapper("<your_connection_string>");
BlobContainerClient containerClient = blobStorageWrapper.ServiceClient.GetBlobContainerClient("<container_name>");
3. AzureFormRecognizerWrapper
The AzureFormRecognizerWrapper
class simplifies interaction with the Azure Form Recognizer API. It wraps the DocumentAnalysisClient
provided by the Azure SDK and manages settings like the API key, endpoint, and model ID.
Example usage:
using Tildom.Services;
using Azure.AI.FormRecognizer.DocumentAnalysis;
var settings = new AzureFormRecognizerSettings {
Endpoint = "<your_endpoint>",
ApiKey = "<your_api_key>",
ModelId = "<your_model_id>"
};
var formRecognizerWrapper = new AzureFormRecognizerWrapper(settings);
var client = formRecognizerWrapper.Client;
Settings for AzureFormRecognizerWrapper
public class AzureFormRecognizerSettings {
public string Endpoint { get; init; } = string.Empty;
public string ApiKey { get; init; } = string.Empty;
public string ModelId { get; init; } = string.Empty;
}
Contributing
Feel free to open issues or submit pull requests for improvements and features.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net8.0
- Azure.AI.FormRecognizer (>= 4.1.0)
- Azure.Storage.Blobs (>= 12.22.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.