Lyo.ShortUrl.Postgres
1.0.2
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
<PackageReference Include="Lyo.ShortUrl.Postgres" Version="1.0.2" />
<PackageVersion Include="Lyo.ShortUrl.Postgres" Version="1.0.2" />
<PackageReference Include="Lyo.ShortUrl.Postgres" />
paket add Lyo.ShortUrl.Postgres --version 1.0.2
#r "nuget: Lyo.ShortUrl.Postgres, 1.0.2"
#:package Lyo.ShortUrl.Postgres@1.0.2
#addin nuget:?package=Lyo.ShortUrl.Postgres&version=1.0.2
#tool nuget:?package=Lyo.ShortUrl.Postgres&version=1.0.2
Lyo.ShortUrl.Postgres
EF Core schema and DbContext registration for a PostgreSQL-backed short-URL store.
Heads up — there is no
PostgresShortUrlService/PostgresShortUrlStorein this package. It deliberately ships only the database surface (DbContext, entities, > migrations, options, and DI helpers for the context). To get anIShortUrlServicethat talks to this schema, plug your own implementation on top ofShortUrlDbContext(or > use the in-boxLyo.ShortUrl.ShortUrlServicefor 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+ShortUrlDbContextFactoryunderDatabase/, withDbSet<ShortUrlEntity>andDbSet<UrlClickEntity>. The default schema is"url".ShortUrlEntity— the canonical short-link row: string-keyedId(max 100 chars) used as the short code,LongUrl(≤ 1024), optionalCustomAlias,CreatedTimestamp/UpdatedTimestamp/ExpirationDate/LastAccessedDate,ClickCount,IsActive, and aClicksnavigation. Includes aFromShortenRequest(...)factory and aBuildShortUrl(baseUrl)helper that mirrorsLyo.ShortUrl.ShortUrlService’sBaseUrlbehaviour.UrlClickEntity— append-only click log row (ShortUrlIdFK,ClickedAt, optionalIpAddress/UserAgent/Referrer).*EntityConfigurationFluent API mappings under the same folder.PostgresShortUrlOptions(SectionName = "PostgresShortUrl",Schema = "url",ConnectionString,EnableAutoMigrations).Constants.Metricsnames (urlshortener.postgres.statistics.duration,.delete.duration,.update.duration) — reserved for downstream service implementations.InitialCreatemigration underMigrations/.
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.Binder10.0.5— (direct, microsoft)Lyo.Common— (transitive, lyo)Lyo.Metrics— (transitive, lyo)Lyo.Result— (transitive, lyo)Microsoft.EntityFrameworkCore10.0.5— (transitive, microsoft)Microsoft.EntityFrameworkCore.Design10.0.5— (transitive, microsoft)Microsoft.EntityFrameworkCore.Relational10.0.5— (transitive, microsoft)Microsoft.Extensions.DependencyInjection.Abstractions10.0.5— (transitive, microsoft)Microsoft.Extensions.Hosting.Abstractions10.0.5— (transitive, microsoft)Microsoft.Extensions.Logging.Abstractions10.0.5— (transitive, microsoft)Microsoft.Extensions.Options10.0.5— (transitive, microsoft)Microsoft.Extensions.Options.ConfigurationExtensions10.0.5— (transitive, microsoft)Npgsql.EntityFrameworkCore.PostgreSQL10.0.3— (transitive, third-party)System.Memory4.6.3— (transitive, microsoft, netstandard2.0)System.Text.Json10.0.5— (transitive, microsoft, netstandard2.0)
| Product | Versions 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. |
-
net10.0
- Lyo.Exceptions (>= 1.0.2)
- Lyo.Postgres (>= 1.0.2)
- Lyo.ShortUrl (>= 1.0.2)
- Microsoft.Extensions.Configuration.Binder (>= 10.0.5)
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.