Skip to content

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.SqlServer

Provider 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 ​