Docs / Core API Overview

Core API Overview

What this page covers#

This page gives a high-level view of the main MooDb types and how they relate to each other.

Main types#

MooDbContext#

The main entry point for ordinary database work.

Use it for:

  • stored procedure execution
  • scalar reads
  • single-row reads
  • list reads
  • multiple result sets
  • starting a transaction

It also exposes:

  • Sql for raw SQL text
  • Bulk for bulk insert outside a transaction

MooTransaction#

The transactional version of the main entry point.

It mirrors most of the same operation shapes as MooDbContext, but all work happens inside a live SQL Server transaction.

It also exposes:

  • Sql for raw SQL inside the transaction
  • Bulk for bulk insert inside the transaction

MooSql#

The raw SQL execution surface.

It exists so SQL text is explicit instead of mixed silently into the stored-procedure-first path.

MooParams#

A fluent SQL Server parameter builder.

It is used wherever MooDb accepts an IReadOnlyList<SqlParameter>.

IMooMultiReader#

The sequential reader used inside QueryMultipleAsync(...).

It lets you consume multiple result sets one by one.

MooBulk#

The bulk insert surface.

Use it when you want to write many rows directly into a table efficiently.

Common operation shapes#

Across MooDbContext, MooTransaction, and MooSql, the main operation shapes are:

  • ExecuteAsync(...)
  • ScalarAsync<T>(...)
  • SingleAsync<T>(...)
  • SingleAsync<T>(..., Func<SqlDataReader, T> map, ...)
  • ListAsync<T>(...)
  • ListAsync<T>(..., Func<SqlDataReader, T> map, ...)
  • QueryMultipleAsync<TResult>(...)

That consistency is one of the strongest parts of the API.