Revo.DataAccess 1.33.0

.NET 6.0
dotnet add package Revo.DataAccess --version 1.33.0
NuGet\Install-Package Revo.DataAccess -Version 1.33.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Revo.DataAccess" Version="1.33.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Revo.DataAccess --version 1.33.0
#r "nuget: Revo.DataAccess, 1.33.0"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install Revo.DataAccess as a Cake Addin
#addin nuget:?package=Revo.DataAccess&version=1.33.0

// Install Revo.DataAccess as a Cake Tool
#tool nuget:?package=Revo.DataAccess&version=1.33.0

<p align="center"> <img src="https://github.com/revoframework/Revo/blob/develop/res/revo-framework.png" alt="Revo framework"> </p> <p align="center"> <a href="https://dev.azure.com/revoframework/Revo/_build?definitionId=1&view=runs"><img src="https://img.shields.io/azure-devops/build/revoframework/7ff8258b-dd3c-4007-9d06-7609742e93cf/1/develop?style=flat-square&logo=azure-pipelines" alt="Build status"></a> <a href="https://codecov.io/gh/revoframework/Revo"><img src="https://img.shields.io/codecov/c/github/revoframework/Revo?logo=codecov&style=flat-square" alt="Code coverage"></a> <a href="https://github.com/revoframework/Revo/releases"><img src="https://img.shields.io/github/release-date/revoframework/Revo?label=latest%20release&style=flat-square" alt="Latest release date"></a> <a href="https://www.nuget.org/packages?q=revo"><img src="https://img.shields.io/nuget/v/Revo.Core?logo=NuGet&style=flat-square" alt="NuGet packages"></a> <a href="https://pkgs.dev.azure.com/revoframework/_packaging/revoframework/nuget/v3/index.json"><img src="https://img.shields.io/badge/nuget%20CI-source-blue?logo=NuGet&style=flat-square" alt="CI NuGet feed at Azure"></a><br> <a href="https://revoframework.gitbook.io/revo/"><img src="https://img.shields.io/badge/docs-GITBOOK-blue.svg?style=flat-square" alt="Docs"></a> <a href="https://gitter.im/revoframework/Revo?utm_source=share-link&utm_medium=link&utm_campaign=share-link"><img src="https://img.shields.io/gitter/room/revoframework/Revo?color=4BB595&logo=gitter&&style=flat-square" alt="Gitter chat"></a> <a href="https://github.com/revoframework/Revo/pulls"><img src="https://img.shields.io/badge/PRs-welcome-green?style=flat-square" alt="PRs welcome"></a> <a href="https://github.com/revoframework/Revo/blob/develop/LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square" alt="License"></a> </p>

Revo Framework

Revo is an application framework for modern server C#/.NET applications built with event sourcing, CQRS and DDD.

Development of this framework is supported by <a href="https://olify.io">OLIFY - smarter solution for facility management & maintenance.</a>

Contents

⚡️ Features

The project combines the concepts of event sourcing, CQRS and DDD to provide framework for building applications that are scalable, maintainable, can work in distributed environments and are easy to integrate with outside world. As such, it takes some rather opinionated approaches on the design of certain parts of its architecture. Revo also offers other common features and infrastructure that is often necessary for building complete applications – for example, authorizations, validations, messaging, integrations, multi-tenancy or testing. Furthermore, its extensions implement other useful features like entity history change-tracking, auditing or user notifications.

Domain-Driven Design
Building blocks for rich DDD-style domain models (aggregates, entities, value objects, domain events, repositories...).

Event Sourcing
Implementing event-sourced entity persistence with support for multiple event store backends (PostgreSQL, MSSQL, SQLite...).

CQRS
Segregating command and query responsibilities with:

A/synchronous event processing
Support for both synchronous and asynchronous event processing, guaranteed at-least-once delivery, event queues with strict sequence ordering (optionally), event source catch-ups, optional pseudo-synchronous event dispatch for listeners (projectors, for example).

Data access
Thin abstraction layer for easy data persistence (e.g. querying read models) using Entity Framework Core, Entity Framework 6, RavenDB, testable in-memory database or other data providers. Includes support for simple database migrations.

Projections
Support for read-model projections with various backends (e.g. Entity Framework Core (PostgreSQL, MSSQL, SQLite,...), Entity Framework 6, RavenDB...), automatic idempotency- and concurrency-handling, etc.

SOA, messaging and integration
Scale and integrate by publishing and receiving events, commands and queries using common messaging patterns,<br> e.g. with RabbitMQ message queue (using EasyNetQ connector or Rebus service bus).

Sagas
Coordinating long-running processes or inter-aggregate cooperation with sagas that react to events<br>(a.k.a. process managers).

Authorization
Basic permission/role-based ACL for commands and queries, fine-grained row filtering.

Other minor features:

👓 Show me how it looks!

Super-short example of a simple application that can save tasks using event-sourced aggregates and then query them back from a RDBMS.

Event

The event that happens when changing a task's name.

public class TodoRenamedEvent : DomainAggregateEvent
{
    public TodoRenamedEvent(string name)
    {
        Name = name;
    }

    public string Name { get; }
}

Aggregate

The task aggregate root.

public class Todo : EventSourcedAggregateRoot
{
    public Todo(Guid id, string name) : base(id)
    {
        Rename(name);
    }
    
    protected Todo(Guid id) : base(id)
    {
    }
    
    public string Name { get; private set; }
    
    public void Rename(string name)
    {
        if (!Name != name)
        {
            Publish(new TodoRenamedEvent(name));
        }
    }
    
    private void Apply(TodoRenamedEvent ev)
    {
        Name = ev.Name;
    }
}

Command and command handler

Command to save a new task.

public class CreateTodoCommand : ICommand
{
    public CreateTodoCommand(string name)
    {
        Name = name;
    }

    [Required]
    public string Name { get; }
}
public class TodoCommandHandler : ICommandHandler<CreateTodoCommand>
{
    private readonly IRepository repository;
    
    public TodoCommandHandler(IRepository repository)
    {
        this.repository = repository;
    }
    
    public Task HandleAsync(CreateTodoCommand command, CancellationToken cancellationToken)
    {
        var todo = new Todo(command.Id);
        todo.Rename(command.Name);
        repository.Add(todoList);
        return Task.CompletedTask;
    }   
}

Read model and projection

Read model and a projection for the event-sourced aggregate.

public class TodoReadModel : EntityReadModel
{
    public string Name { get; set; }
}
public class TodoListReadModelProjector : EFCoreEntityEventToPocoProjector<Todo, TodoReadModel>
{
    public TodoListReadModelProjector(IEFCoreCrudRepository repository) : base(repository)
    {
    }
    
    private void Apply(IEventMessage<TodoRenamedEvent> ev)
    {
        Target.Name = ev.Event.Name;
    }
}

Query and query handler

Query to read the tasks back from a RDBMS.

public class GetTodosQuery : IQuery<IQueryable<TodoReadModel>>
{
}
public class TaskQueryHandler : IQueryHandler<GetTodoQuery, IQueryable<TodoReadModel>>
{
    private readonly IReadRepository readRepository;
    
    public TaskListQueryHandler(IReadRepository readRepository)
    {
        this.readRepository = readRepository;
    }
    
    public Task<IQueryable<TodoReadModel>> HandleAsync(GetTodoListsQuery query, CancellationToken cancellationToken)
    {
        return Task.FromResult(readRepository
            .FindAll<TodoListReadModel>());
    }
}

🚀 Getting started

If you are new to the framework, you can

You can also start by reading the 📘 reference guide.

📦 Packages

Released version are available in form of NuGet packages.
There is also a separate pre-release CI package feed at Azure.

<div style="width:100%";> <table border="0" cellpadding="0" cellspacing="0" style="float:left;"> <tr> <th colspan="2"> Core </th> </tr> <tr> <td> Revo.Core </td> <td> <a href="https://www.nuget.org/packages/Revo.Core/"><img src="https://img.shields.io/nuget/v/Revo.Core.svg" alt="NuGet package version"></a> </td> </tr> <tr> <td> Revo.DataAccess </td> <td> <a href="https://www.nuget.org/packages/Revo.DataAccess/"><img src="https://img.shields.io/nuget/v/Revo.DataAccess.svg" alt="NuGet package version"></a> </td> </tr> <tr> <td> Revo.Domain </td> <td> <a href="https://www.nuget.org/packages/Revo.Domain/"><img src="https://img.shields.io/nuget/v/Revo.Domain.svg" alt="NuGet package version"></a> </td> </tr> <tr> <td> Revo.Infrastructure </td> <td> <a href="https://www.nuget.org/packages/Revo.Infrastructure/"><img src="https://img.shields.io/nuget/v/Revo.Infrastructure.svg" alt="NuGet package version"></a> </td> </tr> <tr> <td> Revo.Testing </td> <td> <a href="https://www.nuget.org/packages/Revo.Testing/"><img src="https://img.shields.io/nuget/v/Revo.Testing.svg" alt="NuGet package version"></a> </td> </tr> </table>

<table border="0" cellpadding="0" cellspacing="0" style="float:left;"> <tr> <th colspan="2"> Data access </th> </tr> <tr> <td> Revo.EFCore </td> <td> <a href="https://www.nuget.org/packages/Revo.EFCore/"><img src="https://img.shields.io/nuget/v/Revo.EFCore.svg" alt="NuGet package version"></a> </td> </tr> <tr> <td> Revo.EF6 </td> <td> <a href="https://www.nuget.org/packages/Revo.EF6/"><img src="https://img.shields.io/nuget/v/Revo.EF6.svg" alt="NuGet package version"></a> </td> </tr> <tr> <td> Revo.RavenDB </td> <td> <a href="https://www.nuget.org/packages/Revo.RavenDB/"><img src="https://img.shields.io/nuget/v/Revo.RavenDB.svg" alt="NuGet package version"></a> </td> </tr> </table>

<table border="0" cellpadding="0" cellspacing="0" style="float:left;"> <tr> <th colspan="2"> Platforms </th> </tr> <tr> <td> Revo.AspNetCore </td> <td> <a href="https://www.nuget.org/packages/Revo.AspNetCore/"><img src="https://img.shields.io/nuget/v/Revo.AspNetCore.svg" alt="NuGet package version"></a> </td> </tr> <tr> <td> Revo.Hangfire </td> <td> <a href="https://www.nuget.org/packages/Revo.Hangfire/"><img src="https://img.shields.io/nuget/v/Revo.Hangfire.svg" alt="NuGet package version"></a> </td> </tr> </table>

<table border="0" cellpadding="0" cellspacing="0" style="float:left;"> <tr> <th colspan="2"> Integrations </th> </tr> <tr> <td> Revo.EasyNetQ (RabbitMQ connector) </td> <td> <a href="https://www.nuget.org/packages/Revo.EasyNetQ/"><img src="https://img.shields.io/nuget/v/Revo.EasyNetQ.svg" alt="NuGet package version"></a> </td> </tr> <tr> <td> Revo.Rebus (service bus, deprecated) </td> <td> <a href="https://www.nuget.org/packages/Revo.Rebus/"><img src="https://img.shields.io/nuget/v/Revo.Rebus.svg" alt="NuGet package version"></a> </td> </tr> </table>

<table border="0" cellpadding="0" cellspacing="0" style="float:left;"> <tr> <th colspan="2"> Other extensions </th> </tr> <tr> <td> Revo.Extensions.History </td> <td> <a href="https://www.nuget.org/packages/Revo.Extensions.History/"><img src="https://img.shields.io/nuget/v/Revo.Extensions.History.svg" alt="NuGet package version"></a> </td> </tr> <tr> <td> Revo.Extensions.Notifications </td> <td> <a href="https://www.nuget.org/packages/Revo.Extensions.Notifications/"><img src="https://img.shields.io/nuget/v/Revo.Extensions.Notifications.svg" alt="NuGet package version"></a> </td> </tr> </table> </div>

Most applications will require at least Revo.Core, Revo.DataAccess, Revo.Domain, Revo.Infrastructure packages to get started with and then typically a platform package like Revo.Platforms.AspNetCore (ASP.NET Core platform implementation) and a data-access package like Revo.EFCore (for Entity Framework Core support).

📑 License

MIT License

Copyright (c) 2017-2020 Martin Zima<br> Copyright (c) 2017-2020 Olify IO s.r.o.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH > THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Product Versions
.NET net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows net7.0 net7.0-android net7.0-ios net7.0-maccatalyst net7.0-macos net7.0-tvos net7.0-windows
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Revo.DataAccess:

Package Downloads
Revo.Domain

Event Sourcing, CQRS and DDD framework for modern C#/.NET applications. Base domain model package.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.33.0 389 1/15/2023
1.31.0 643 1/4/2023
1.30.3 1,277 11/10/2022
1.30.2 1,879 10/12/2022
1.30.1 2,243 6/17/2022
1.30.0 2,052 5/17/2022
1.29.0 2,429 3/1/2022
1.28.1 2,183 2/3/2022
1.28.0 2,227 1/27/2022
1.27.2 1,133 12/15/2021
1.27.1 1,045 12/12/2021
1.26.1 1,705 10/21/2021
1.26.0 1,526 10/20/2021
1.25.1 1,693 7/27/2021
1.25.0 1,485 7/27/2021
1.23.0 1,568 5/19/2021
1.22.0 1,518 4/30/2021
1.21.0 1,655 2/19/2021
1.20.2 1,595 2/12/2021
1.20.1 1,788 12/19/2020
1.20.0 1,728 12/19/2020
1.19.0 1,992 12/6/2020
1.18.2 2,030 11/21/2020
1.18.1 2,290 11/16/2020
1.17.0 1,812 8/25/2020
1.16.0 1,617 6/23/2020
1.15.0 2,337 3/5/2020
1.14.1 2,291 2/26/2020
1.13.1 1,984 1/15/2020
1.13.0 1,950 11/29/2019
1.12.0 1,748 10/22/2019
1.11.0 1,984 9/3/2019
1.10.0 2,030 6/3/2019
1.9.1 2,033 5/15/2019
1.9.0 2,589 3/15/2019
1.8.0 1,897 3/4/2019
1.7.0 1,912 2/14/2019
1.6.0 1,904 1/17/2019
1.5.0 2,716 1/10/2019
1.4.0 2,729 11/5/2018
1.3.0 1,229 8/31/2018
1.2.0 1,494 7/16/2018