Lyo.ShortUrl.Postgres 1.0.2

There is a newer version of this package available.
See the version list below for details.
dotnet add package Lyo.ShortUrl.Postgres --version 1.0.2
                    
NuGet\Install-Package Lyo.ShortUrl.Postgres -Version 1.0.2
                    
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="Lyo.ShortUrl.Postgres" Version="1.0.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Lyo.ShortUrl.Postgres" Version="1.0.2" />
                    
Directory.Packages.props
<PackageReference Include="Lyo.ShortUrl.Postgres" />
                    
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 Lyo.ShortUrl.Postgres --version 1.0.2
                    
#r "nuget: Lyo.ShortUrl.Postgres, 1.0.2"
                    
#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 Lyo.ShortUrl.Postgres@1.0.2
                    
#: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=Lyo.ShortUrl.Postgres&version=1.0.2
                    
Install as a Cake Addin
#tool nuget:?package=Lyo.ShortUrl.Postgres&version=1.0.2
                    
Install as a Cake Tool

Lyo.ShortUrl.Postgres

EF Core schema and DbContext registration for a PostgreSQL-backed short-URL store.

Heads up — there is no PostgresShortUrlService / PostgresShortUrlStore in this package. It deliberately ships only the database surface (DbContext, entities, > migrations, options, and DI helpers for the context). To get an IShortUrlService that talks to this schema, plug your own implementation on top of ShortUrlDbContext (or > use the in-box Lyo.ShortUrl.ShortUrlService for id-only generation; it does not persist anything).

Examples

DI registration (Extensions)

services.AddShortUrlDbContextFactoryFromConfiguration(configuration);

services.AddSingleton<IShortUrlService, MyEfBackedShortUrlService>();
// where MyEfBackedShortUrlService takes IDbContextFactory<ShortUrlDbContext>
// and IShortUrlGenerator (services.AddShortUrlGenerator()).

What ships

  • ShortUrlDbContext + ShortUrlDbContextFactory under Database/, with DbSet<ShortUrlEntity> and DbSet<UrlClickEntity>. The default schema is "url".
  • ShortUrlEntity — the canonical short-link row: string-keyed Id (max 100 chars) used as the short code, LongUrl (≤ 1024), optional CustomAlias, CreatedTimestamp / UpdatedTimestamp / ExpirationDate / LastAccessedDate, ClickCount, IsActive, and a Clicks navigation. Includes a FromShortenRequest(...) factory and a BuildShortUrl(baseUrl) helper that mirrors Lyo.ShortUrl.ShortUrlService’s BaseUrl behaviour.
  • UrlClickEntity — append-only click log row (ShortUrlId FK, ClickedAt, optional IpAddress / UserAgent / Referrer).
  • *EntityConfiguration Fluent API mappings under the same folder.
  • PostgresShortUrlOptions (SectionName = "PostgresShortUrl", Schema = "url", ConnectionString, EnableAutoMigrations).
  • Constants.Metrics names (urlshortener.postgres.statistics.duration, .delete.duration, .update.duration) — reserved for downstream service implementations.
  • InitialCreate migration under Migrations/.

DI registration (Extensions)

Entry point What it does
AddShortUrlDbContext(string connectionString) Registers the DbContext factory plus a scoped ShortUrlDbContext resolved from the factory.
AddShortUrlDbContext(Action<DbContextOptionsBuilder>) Bare AddDbContext<ShortUrlDbContext>(...) — bring your own provider configuration.
AddShortUrlDbContextFactory(Action<PostgresShortUrlOptions>) (plus (options) and FromConfiguration overloads) Registers IOptions<PostgresShortUrlOptions>, AddPostgresMigrations<ShortUrlDbContext, PostgresShortUrlOptions>(), and IDbContextFactory<ShortUrlDbContext> (UseNpgsql + migrations history under the url schema).

There is intentionally no AddPostgresShortUrlStore / AddPostgresShortUrlService — see the note at the top of this README. Wire your own service on top of the factory, for example:

Schema

Table Notable columns
url.short_urls Id (PK, string ≤ 100), LongUrl (≤ 1024), CustomAlias? (≤ 100), CreatedTimestamp, UpdatedTimestamp?, ExpirationDate?, LastAccessedDate?, ClickCount, IsActive.
url.url_clicks Id (PK, long), ShortUrlId (FK → short_urls.Id), ClickedAt, optional IpAddress (≤ 45), UserAgent (≤ 500), Referrer (≤ 512).

(Exact table / column names follow the EF defaults plus the configurations under Database/. The migrations history is tracked in __EFMigrationsHistory under the same url schema.)

Dependencies

Generated from ProjectReference / PackageReference (same model as docs/Lyo.ProjectGraph.html).

  • Lyo.Exceptions — (direct, lyo)
  • Lyo.Postgres — (direct, lyo)
  • Lyo.ShortUrl — (direct, lyo)
  • Microsoft.Extensions.Configuration.Binder 10.0.5 — (direct, microsoft)
  • Lyo.Common — (transitive, lyo)
  • Lyo.Metrics — (transitive, lyo)
  • Lyo.Result — (transitive, lyo)
  • Microsoft.EntityFrameworkCore 10.0.5 — (transitive, microsoft)
  • Microsoft.EntityFrameworkCore.Design 10.0.5 — (transitive, microsoft)
  • Microsoft.EntityFrameworkCore.Relational 10.0.5 — (transitive, microsoft)
  • Microsoft.Extensions.DependencyInjection.Abstractions 10.0.5 — (transitive, microsoft)
  • Microsoft.Extensions.Hosting.Abstractions 10.0.5 — (transitive, microsoft)
  • Microsoft.Extensions.Logging.Abstractions 10.0.5 — (transitive, microsoft)
  • Microsoft.Extensions.Options 10.0.5 — (transitive, microsoft)
  • Microsoft.Extensions.Options.ConfigurationExtensions 10.0.5 — (transitive, microsoft)
  • Npgsql.EntityFrameworkCore.PostgreSQL 10.0.3 — (transitive, third-party)
  • System.Memory 4.6.3 — (transitive, microsoft, netstandard2.0)
  • System.Text.Json 10.0.5 — (transitive, microsoft, netstandard2.0)
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 Lyo.ShortUrl.Postgres:

Package Downloads
Lyo.Leaderboard.Api

HTTP API for Lyo.Leaderboard. Embed via AddLeaderboardApi / MapLeaderboardApiEndpoints.

Lyo.ShortUrl.Seed

EF seed of short URLs and one click each.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
3.0.0 114 10/23/2026
2.0.1 124 9/14/2026
2.0.0 117 9/9/2026
1.0.13 129 8/25/2026
1.0.11 117 8/23/2026
1.0.9 134 8/22/2026
1.0.6 121 8/20/2026
1.0.4 117 8/20/2026
1.0.3 121 8/19/2026
1.0.2 119 8/19/2026
1.0.1 132 8/18/2026
1.0.0 130 8/16/2026