Appearance
Quickstart
Connect, insert, query, and dispose — the minimal path through JASE.Database.
Install
powershell
dotnet add package JASE.Database
dotnet add package JASE.Database.Postgres # or JASE.Database.SqlServerProvider packages register the engine-specific SQL generator and connection factory. The core package alone is not enough to open a session.
Define a POCO
Map with attributes. Primary keys need a settable (or init) property so materialization can load them.
csharp
using JASE.Database;
[Table("customers")]
public sealed class Customer
{
[PrimaryKey]
public Guid Id { get; set; }
public string Name { get; set; } = "";
}See JASE.Database/docs/entity-poco-binding.md in the Suite repo for immutable columns and edge cases.
Open a session
csharp
using JASE.Database;
using JASE.Database.Credentials;
var credentials = new StaticCredentialProvider("app_user", "secret");
var config = new DatabaseConfig(
DatabaseType.PostgreSql, // or DatabaseType.SqlServer
"localhost",
"appdb",
credentials);
await using IDatabaseSession session = await DbSession.GetAsync(config);
await session.OpenAsync();await using disposes the session and returns pooled connections. Prefer this over manual Close/Dispose.
Insert and read
csharp
var row = new Customer { Id = Guid.NewGuid(), Name = "Ada" };
await session.InsertAsync(row);
Customer loaded = await session.GetByPkAsync<Customer>(row.Id);
List<Customer> matches = await session.GetListAsync(
session.Query<Customer>()
.Where(c => c.Name == "Ada")
.Limit(50));Query<T>() returns a fluent QueryBuilder<T>. Empty WHERE on DELETE/UPDATE is rejected by default — use AllowUnfilteredMutation() only when you intentionally mean “all rows.”
Next steps
- Statement-level SQL logging: Logging
- How rows become POCOs: Mapping & Materialization
TableInfoand schema reconcile: Schema & Reconciliation- Soft-launch consumer contract (Forge):
JASE.Database/docs/forge-orm-contract.md - API:
DbSession,QueryBuilder<T>