Tildom.Services 8.0.0

Prefix Reserved
There is a newer version of this package available.
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                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Tildom.Services" Version="8.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Tildom.Services --version 8.0.0                
#r "nuget: Tildom.Services, 8.0.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
8.1.0 82 12/2/2024
8.0.2 106 9/22/2024
8.0.1 91 9/22/2024
8.0.0 96 9/22/2024