Skip to content
@Syrx

Syrx

Collection of repositories for the Syrx project - free your data!

Syrx Data Access Framework

Syrx Logo

Database-Agnostic Data Access Framework for .NET

MIT License .NET NuGet Build Status

DocumentationQuick StartExamplesNuGet Packages

🎯 What is Syrx?

Syrx is a .NET database abstraction framework that decouples your repository code from underlying data stores while emphasizing:

  • 🎮 Control - Full developer control over data and execution
  • ⚡ Speed - Built on Dapper for maximum performance
  • 🔄 Flexibility - Easily switch between database technologies
  • 🧪 Testability - Fully testable at all levels
  • 🔧 Extensibility - Granular, componentized architecture
  • 📖 Readability - Clear, concise code intent

🚀 Quick Start

Installation

# Choose your database provider
dotnet add package Syrx.SqlServer.Extensions    # SQL Server
dotnet add package Syrx.MySql.Extensions        # MySQL
dotnet add package Syrx.Npgsql.Extensions       # PostgreSQL  
dotnet add package Syrx.Oracle.Extensions       # Oracle

Configuration

// Program.cs
services.UseSyrx(syrx => syrx
    .UseSqlServer(sqlServer => sqlServer
        .AddConnectionString("default", connectionString)
        .AddCommand<ProductRepository>(commands => commands
            .ForMethod(nameof(ProductRepository.GetAllAsync), cmd => cmd
                .UseConnectionAlias("default")
                .UseCommandText("SELECT * FROM Products")))));

Usage

public class ProductRepository(ICommander<ProductRepository> commander)
{
    private readonly ICommander<ProductRepository> _commander = commander;
    
    public async Task<IEnumerable<Product>> GetAllAsync() 
        => await _commander.QueryAsync<Product>();
}

🏗️ Architecture

Syrx provides a clean separation between your application logic and data access:

┌─────────────────┐    ┌─────────────────┐    ┌─────────────────┐
│   Repository    │───▶│   ICommander    │───▶│ DatabaseProvider │
│                 │    │                 │    │                 │
│ Business Logic  │    │ Query/Execute   │    │ SQL Server      │
│                 │    │   Operations    │    │ MySQL/Postgres  │
└─────────────────┘    └─────────────────┘    │ Oracle          │
                                              └─────────────────┘

📦 Packages Overview

Core Framework

Package Description NuGet
Syrx Core abstractions and interfaces NuGet
Syrx.Settings Configuration settings and abstractions NuGet

Database Providers

Provider Package NuGet
SQL Server Syrx.SqlServer.Extensions NuGet
MySQL Syrx.MySql.Extensions NuGet
PostgreSQL Syrx.Npgsql.Extensions NuGet
Oracle Syrx.Oracle.Extensions NuGet

🌟 Key Features

Database Agnostic

Switch between SQL Server, MySQL, PostgreSQL, and Oracle with configuration changes only.

Built on Dapper

Inherit all of Dapper's performance benefits while gaining additional abstraction layers.

Command Resolution

Automatic mapping from method names to SQL commands using [CallerMemberName] attribute.

Multi-Mapping Support

Handle complex object composition with support for up to 16 input parameters.

Comprehensive Testing

Full test coverage with unit and integration tests for all database providers.

📚 Documentation

🤝 Community

🎯 Example Scenarios

Multi-Database Application

services.UseSyrx(syrx => syrx
    .UseSqlServer(sql => sql.AddConnectionString("primary", sqlConnection))
    .UseNpgsql(pg => pg.AddConnectionString("analytics", pgConnection)));

Complex Queries with Multi-Mapping

public async Task<IEnumerable<Order>> GetOrdersWithCustomersAsync()
    => await _commander.QueryAsync<Order, Customer, Order>(
        (order, customer) => { order.Customer = customer; return order; });

Transaction Management

public async Task<bool> TransferInventoryAsync(int fromId, int toId, int quantity)
    => await _commander.ExecuteAsync(new { fromId, toId, quantity });

🛠️ Contributing

We welcome contributions! Please see our Contributing Guide for details.

Development Setup

  1. Clone the repository
  2. Install .NET 8.0+ SDK
  3. Run dotnet restore
  4. Run dotnet test to verify setup

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🙏 Acknowledgments

  • Built on top of the excellent Dapper micro-ORM
  • Inspired by the need for flexible, testable data access patterns
  • Community feedback and contributions that make this framework better

Get StartedView ExamplesBrowse Packages

Made with ❤️ by the Syrx community

Popular repositories Loading

  1. Syrx Syrx Public

    Syrx core repository

    C# 2 1

  2. Syrx.Validation Syrx.Validation Public

    A very simple precondition checker with very little overhead.

    C#

  3. Syrx.SqlServer Syrx.SqlServer Public

    Repository for SQL Server specific components for Syrx

    C#

  4. Syrx.MySql Syrx.MySql Public

    Repository for MySQL specific components for Syrx

    C#

  5. Syrx.Npgsql Syrx.Npgsql Public

    Repository for PostgreSQL specific components for Syrx

    C#

  6. Syrx.Oracle Syrx.Oracle Public

    Repository for SQL Server specific components for Syrx

    C#

Repositories

Showing 10 of 11 repositories

People

This organization has no public members. You must be a member to see who’s a part of this organization.

Top languages

Loading…

Most used topics

Loading…