🚨 Latest Research:Tanstack npm Packages Compromised in Ongoing Mini Shai-Hulud Supply-Chain Attack.Learn More →
Socket
Book a DemoSign in
Socket

absolutealgorithm.api.common

Package Overview
Dependencies
Maintainers
0
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package was removed
Sorry, it seems this package was removed from the registry

absolutealgorithm.api.common

unpublished
nugetNuGet
Version
1.0.0-dev.11
Version published
Maintainers
0
Created
Source

AbsoluteAlgorithm.Api.Common

A comprehensive common library for building robust ASP.NET Core Web APIs, featuring database management, audit logging, rate limiting, and standard middleware pipelines.

Installation

Install the package via NuGet:

dotnet add package AbsoluteAlgorithm.Api.Common --prerelease

Usage Setup

Configure the application in Program.cs using ApplicationConfiguration to set up databases, rate limiting, and the absolute pipeline.

try
{
    ApplicationConfiguration appConfig = new ApplicationConfiguration
    {
        UseRelationalDatabase = true,
        DatabasePolicies = new List<DatabasePolicy>
        {
            new DatabasePolicy
            {
                DatabaseProvider = DatabaseProvider.MSSQL,
                ConnectionStringName = "MSSQLCS",
                InitializeDatabase = true,
                InitializeAuditTable = true,
                InitializationScript = msSqlScript,
                DatabaseName = "testdb",
                MaxPoolSize = 100,
                MinPoolSize = 10,
                CommandTimeoutSeconds = 30
            },
            new DatabasePolicy
            {
                DatabaseProvider = DatabaseProvider.PostgreSQL,
                ConnectionStringName = "POSTGRESCS",
                InitializeDatabase = true,
                InitializeAuditTable = true,
                InitializationScript = postgreSqlScript,
                DatabaseName = "test_db",
                MaxPoolSize = 100,
                MinPoolSize = 10,
                CommandTimeoutSeconds = 30
            }
        },
        UseRateLimit = true,
        RateLimitPolicies = new List<RateLimitPolicy>
        {
            new RateLimitPolicy
            {
                PolicyName = "rpol",
                Algorithm = RateLimitAlgorithm.FixedWindow,
                Scope = RateLimitScope.IpAddress,
                PermitLimit = 2,
                Window = TimeSpan.FromSeconds(2)
            }
        }
    };
    #endregion

    WebApplicationBuilder builder = WebApplication.CreateBuilder(args);
    builder.RegisterAbsoluteWebApplicationBuilder(appConfig);

    WebApplication app = builder.Build();

    app.UseAbsolutePipeline(appConfig);

    app.Run();
}
catch (Exception ex)
{
    var logger = LogManager.GetCurrentClassLogger();
    logger.Error(ex, "an error occured: {message}", ex.Message);
    throw;
}
finally
{
    LogManager.Shutdown();
}

Configuration Reference

ApplicationConfiguration

PropertyTypeDescription
UseRelationalDatabaseboolEnables relational database services and middleware.
DatabasePoliciesList<DatabasePolicy>List of database configurations to initialize and manage.
UseRateLimitboolEnables rate limiting middleware.
RateLimitPoliciesList<RateLimitPolicy>List of rate limiting policies to apply.

DatabasePolicy

PropertyTypeDescription
DatabaseProviderDatabaseProviderThe database type (e.g., MSSQL, PostgreSQL).
ConnectionStringNamestringEnvironment variable name containing the connection string.
InitializeDatabaseboolIf true, attempts to create the database if it doesn't exist.
InitializeAuditTableboolIf true, sets up the audit_logs table and triggers.
InitializationScriptstringCustom SQL script executed during initialization (e.g., table creation).
DatabaseNamestringUnique name for the database connection (used for pooling/resources).
MaxPoolSizeintMaximum size of the connection pool.
MinPoolSizeintMinimum size of the connection pool.
CommandTimeoutSecondsintTime in seconds before a command times out.

RateLimitPolicy

PropertyTypeDescription
PolicyNamestringUnique identifier for the policy (used in [EnableRateLimiting]).
AlgorithmRateLimitAlgorithmThe rate limiting algorithm (e.g., FixedWindow).
ScopeRateLimitScopeScope of the limit (e.g., IpAddress, User).
PermitLimitintNumber of permitted requests in the window.
WindowTimeSpanTime window duration for the limit.

Keywords

c#

FAQs

Package last updated on 15 Mar 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts