Flaminco.ImmutableStates 1.0.0

dotnet add package Flaminco.ImmutableStates --version 1.0.0                
NuGet\Install-Package Flaminco.ImmutableStates -Version 1.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="Flaminco.ImmutableStates" Version="1.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Flaminco.ImmutableStates --version 1.0.0                
#r "nuget: Flaminco.ImmutableStates, 1.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 Flaminco.ImmutableStates as a Cake Addin
#addin nuget:?package=Flaminco.ImmutableStates&version=1.0.0

// Install Flaminco.ImmutableStates as a Cake Tool
#tool nuget:?package=Flaminco.ImmutableStates&version=1.0.0                

Flaminco.ImmutableStates

Flaminco.ImmutableStates is a .NET library designed to manage immutable state entities within an application. It provides a simple and efficient way to look up and manage immutable states using Entity Framework Core.

Features

  • Asynchronous Operations: All lookups are performed asynchronously, ensuring non-blocking I/O operations.
  • Flexible Queries: Supports querying by ID, code, group, or custom predicates.
  • Extensible: Easily extendable to support additional functionality.
  • Dependency Injection Support: Seamlessly integrates with ASP.NET Core's dependency injection system.

Installation

You can install the Flaminco.ImmutableStates library via NuGet:

dotnet add package Flaminco.ImmutableStates

Getting Started

1. Define Your DbContext

Ensure that your DbContext includes a DbSet<ImmutableState> for immutable states:

public class YourDbContext : DbContext
{
    public DbSet<ImmutableState> ImmutableStates { get; set; }
}

2. Register the Immutable State Lookup Service

In your Startup.cs or Program.cs, register the IImmutableStateLookup service:

public void ConfigureServices(IServiceCollection services)
{
    services.AddDbContext<YourDbContext>(options => 
        options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")));
        
    services.AddImmutableState<YourDbContext>();
}

3. Use the Immutable State Lookup

Inject the IImmutableStateLookup into your services or controllers:

public class YourService
{
    private readonly IImmutableStateLookup _immutableStateLookup;

    public YourService(IImmutableStateLookup immutableStateLookup)
    {
        _immutableStateLookup = immutableStateLookup;
    }

    public async Task<ImmutableState?> GetStateByCodeAsync(int code)
    {
        return await _immutableStateLookup.GetByCodeAsync(code);
    }
}

Contributing

Contributions are welcome! If you have suggestions, bug reports, or contributions, please submit them as issues or pull requests on our GitHub repository.

License

This project is licensed under the MIT License.

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
1.0.0 105 8/27/2024