Socigy.OpenSource.DB 0.1.77

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

Socigy.OpenSource.DB

A Roslyn source-generator–powered ORM for PostgreSQL. Define your tables with C# attributes, let the generator produce strongly-typed insert/update/delete/query builders, and use the CLI tool to generate and apply migrations — all without writing a line of SQL by hand.

Features

  • Attribute-driven schema — map classes to tables with [Table], [Column], [PrimaryKey], [Default], and more
  • Fluent CRUD builders — insert, update, delete, and query via generated builder methods
  • Lambda WHERE clauses — Query(x => x.Priority > 5 && x.Name != null) translates to SQL
  • Flagged enums — N:M junction tables auto-generated from [FlaggedEnum] / [FlaggedEnumTable] + [FlagTable]
  • Auto-increment sequences — [AutoIncrement] exposes typed sequence helpers
  • CHECK constraints — simple [Check("sql")] or type-safe [Check(typeof(T))] with the DbCheck DSL
  • Validation attributes — [Min], [Max], [Bigger], [Lower], [StringLength], [Unique], and more
  • Cross-platform constants — DbDefaults and DbValues sentinel constants translate to correct SQL per engine
  • Migration tool — CLI that diffs your schema and generates versioned migration files

Installation

Install via NuGet:

dotnet add package Socigy.OpenSource.DB

Or in your .csproj:

<PackageReference Include="Socigy.OpenSource.DB" Version="*" />

The package includes both the runtime Core library and the Roslyn source generator. No manual project-reference wiring is needed.

Documentation

Topic Description
Getting Started Installation, project setup, socigy.json, DI wiring
Defining Tables All table and column attributes with examples
CRUD Operations Insert, Update, Delete builders
Querying Query builder, WHERE expressions, ORDER BY, LIMIT/OFFSET
Flagged Enums N:M junction tables, static & instance helpers, in-memory cache, custom junction classes
Sequences & AutoIncrement [AutoIncrement], sequence accessors
CHECK Constraints [Check], DbCheck DSL, IDbCheckExpression
Validation Attributes Min/Max/Bigger/Lower/StringLength/Unique/Nullable/Equal
DbDefaults & DbValues Cross-platform sentinel constants for defaults and FK actions
Migrations CLI tool, socigy.json, migration workflow, ILocalMigration

Quick Example

// 1. Define your model
[Table("users")]
public partial class User
{
    [PrimaryKey, Default(DbDefaults.Guid.Random)]
    public Guid Id { get; set; }

    [StringLength(50, MinLength = 3)]
    public string Username { get; set; } = "";

    [Default(DbDefaults.Time.Now)]
    public DateTime CreatedAt { get; set; }
}

// 2. Insert
var user = new User { Username = "alice" };
await user.Insert()
    .WithConnection(conn)
    .ExcludeAutoFields()
    .WithValuePropagation()   // writes DB-generated Id/CreatedAt back to instance
    .ExecuteAsync();

// 3. Query
var users = await User.Query(x => x.Username != null)
    .WithConnection(conn)
    .OrderBy(x => new object[] { x.CreatedAt })
    .Limit(10)
    .ExecuteAsync()
    .ToListAsync();

// 4. Update (selected fields only)
user.Username = "alice2";
await user.Update()
    .WithConnection(conn)
    .WithFields(x => new object[] { x.Username })
    .ExecuteAsync();

// 5. Delete
await user.Delete().WithConnection(conn).ExecuteAsync();
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Socigy.OpenSource.DB:

Package Downloads
Socigy.OpenSource.DB.HashiCorp

Optional HashiCorp Vault / OpenBao integration for Socigy.OpenSource.DB: field encryption (KV-v2 key, Transit data-key envelope with key rotation, or Transit EaaS-direct) and rotating DB credentials (Database secrets engine).

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.3.8 367 9/9/2026
0.3.7 203 7/28/2026
0.3.6 303 7/17/2026
0.3.5 289 6/27/2026
0.3.4 173 6/26/2026
0.3.3 181 6/26/2026
0.3.2 183 6/6/2026
0.3.1 177 6/5/2026
0.3.0 169 6/5/2026
0.2.0 133 6/5/2026
0.1.83 154 5/3/2026
0.1.82 140 5/3/2026
0.1.81 141 5/2/2026
0.1.80 121 5/2/2026
0.1.79 131 5/1/2026
0.1.78 121 5/1/2026
0.1.77 149 4/29/2026
0.1.76 135 4/25/2026
0.1.75 129 4/25/2026
0.1.74 125 4/24/2026
Loading failed