Project exploring creating a framework for developing a repository pattern data access layer with limited LINQ handling on CRUD methods
Find a file
2025-10-15 08:51:19 +02:00
.forgejo/workflows Add workflow 2025-10-07 15:41:11 +01:00
Alveus.DAL.Common Simplify pattern 2025-10-14 17:19:06 +01:00
Alveus.DAL.PostgreSql Simplify pattern 2025-10-14 17:19:06 +01:00
Alveus.DAL.Tests Simplify pattern 2025-10-14 17:19:06 +01:00
.gitignore Initial commit 2025-10-07 15:39:19 +01:00
Alveus.DataAccessLayer.sln License and readme 2025-10-08 17:43:47 +01:00
Alveus.ruleset Initial commit 2025-10-07 15:39:19 +01:00
LICENSE.md License and readme 2025-10-08 17:43:47 +01:00
README.md Update README.md 2025-10-15 08:51:19 +02:00

Alveus Data Access Layer (DAL)

Release Build status

A data access layer framework for applying a repository design pattern.

Currently only implements PostgreSQL.

Installation

Install the package via NuGet feed https://nuget.alveus.dev

Defining Entities

Entities are C# classes that represent database tables. Use attributes to define the mapping:

[Table("users")]
public class User
{
    [PrimaryKey("id")]
    public int Id { get; set; }

    [Column("username")]
    public string Username { get; set; }

    [Column("email")]
    public string Email { get; set; }
}

Repository Pattern

The DAL implements the repository pattern through IRepository<TEntity>. Each entity type has its own repository that inherits from this interface:

BaseRepository<TEntity> provides methods to be used by the inheriting repositories.

public class UserRepository : PgsqlRepository<User>, IUserRepository
{
// Implementation of repository methods
}

Transaction Support

When registering DbProvider as a scoped service, the TransactionProvider can be used to wrap db operations in transactions. Nested transactions are supported with postgres.

Database Migrator

A migration helper is provided which will create a migrations table and apply the series of sql scripts present in the migrations directory. These scripts are sorted by filename in ascending order and will only be applied if they haven't already.