Skip to content

Marten

Project home.

Marten is an ORM (Object-Relational mapper) that can leverage PostgreSQL's JSON capabilities to transform PostgreSQL into a .Net Transactional DocumentDB.

By using the JSON column features of PostgreSQL we can store and query data as JSON documents, giving us the flexibility of a document database coupled with the reliability of a relational database.

classDiagram
IQuerySession <-- IDocumentStore : Builds
IDocumentStore <-- DocumentStore : Inheritance
IQuerySession <-- QuerySession : Inheritance
IDocumentSession <-- IDocumentStore : Builds
IQuerySession <-- IDocumentSession : Inheritance
IDocumentSession <-- IdentityMapDocumentSession
IDocumentSession <-- LightWeightDocumentSession
IDocumentSession <-- DirtyCheckingDocumentSession
Class Description
QuerySession Best used for querying documents when you do not need tracking or saving
IdentityMapDocumentSession Cache documents loaded by ID, good for web requests or service requests where many operations need to access the same document
LightWeightDocumentSession Best pracitce. Good for small transactions with a mix of read and write operations. Good for CRUD operations.
DirtyCheckingDocumentSession Keeps track of changes to the loaded document

Always aim to use the lightest session that meets your needs and remember to dispose of the session when done with them.