Almostengr.Common 10.2026.718.2325

dotnet add package Almostengr.Common --version 10.2026.718.2325
                    
NuGet\Install-Package Almostengr.Common -Version 10.2026.718.2325
                    
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="Almostengr.Common" Version="10.2026.718.2325" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Almostengr.Common" Version="10.2026.718.2325" />
                    
Directory.Packages.props
<PackageReference Include="Almostengr.Common" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Almostengr.Common --version 10.2026.718.2325
                    
#r "nuget: Almostengr.Common, 10.2026.718.2325"
                    
#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.
#:package Almostengr.Common@10.2026.718.2325
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Almostengr.Common&version=10.2026.718.2325
                    
Install as a Cake Addin
#tool nuget:?package=Almostengr.Common&version=10.2026.718.2325
                    
Install as a Cake Tool

Almostengr Common Utilities

C# library with code that I often use with custom applications. This library includes the Result pattern and generics for database driven applications. These include, but are not limited to, methods and classes to make changes to entities, generic repository methods, and generic service classes.

By using this class library, it reduces the needs to code common functionality and features in every application that I am creating.

Entity Types

LookupEntity

This type should be used as a base class for any lookup values. Examples include, but is not limited to, states, gender, bank account types, etc. It has predefined properties that are often used with lookup types, but can be extended to fit the type of your creation.

Entity

Entity should be used for any other type of entity that does not meet any of the above criteria. Examples of this includes, but is not limited to, people, car brands, and other real world objects that need to be modeled in your application.

Program.cs Updates

Below is the code that you will need to add to your Program.cs file. Ideally add it after any database configuration, but before any dependent services, such as controllers.

builder.Services.AddCommonServices();

Example Entity Implementation

public class Person : Entity
{
    public string FirstName {get;private set;}

    // other properties related to the entity
}

Example Repository Layer Implementation

public sealed class PersonRepository<Person> : QueryRepository<Person>, IQueryRepository<Person>
{
    public PersonRepository(ApplicationDbContext dbContext) : base(dbContext)
    {}

    public async Task<Person> GetByFirstNameAsync(string firstName)
    {
        return await _dbSet
            .Where(p => p.FirstName == firstName)
            .SingleOrDefaultAsync();
    }

    // additional service methods here
}

Example Service Layer Implementation

public sealed class QueryPersonService<Person, PersonResource> : IQueryService<Person, PersonResource>
{
    private readonly IPersonRepository<Person> _repository;

    public QueryPersonService(IPersonRepository<Person> repository)
    {
        _repository = repository;
    }

    // additional service methods here
}

Example API Key Middleware

In the Program.cs file, add the below:

app.UserMiddleware<ApiKeyMiddleware>();

Also add one of the following (not both) to the Program.cs file:

builder.Services.AddApiKeySettingsServices();

or

builder.Services.AddApiKeyDbServices();

In your ApplicationDbContext.cs file, or similarly named file for your DbContext, add the following:

public required DbSet<ApiKey> ApiKeys {get; set;}

Issues and Feature Requests

Any issues, bugs, or feature requests for this library, should be submitted to its Github repository. When submitting the request, be sure to use the appropriate template. Requests that are not submitted using the appropriate template, may be ignored or rejected.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on Almostengr.Common:

Package Downloads
Almostengr.MgmInsights.Common

Common generic classes and methods used for building MVC and Web API applications.

Almostengr.FalconPiPlayer.ApiClient

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
10.2026.718.2325 117 7/18/2026
10.2026.708.236 114 7/8/2026
10.2026.403.917 146 4/3/2026
9.2025.10.912 220 10/9/2025
9.2025.8.2203 223 8/22/2025
9.2025.8.1502 200 8/15/2025
9.2025.6.601 191 6/6/2025
9.2025.6.101 167 6/1/2025
8.2025.5.28 209 5/28/2025