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>
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:
Super-short example of a simple application that can save tasks using event-sourced aggregates and then query them back from a RDBMS.
The event that happens when changing a task's name.
public class TodoRenamedEvent : DomainAggregateEvent { public TodoRenamedEvent(string name) { Name = name; } public string Name { get; } }
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 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 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 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>()); } }
If you are new to the framework, you can
You can also start by reading the 📘 reference guide.
Released version are available in form of NuGet packages.
There is also a separate pre-release CI package feed at Azure.
AI小说写作助手,一站式润色、改写、扩写
蛙蛙写作—国内先进的AI写作平台,涵盖小说、学术、社交媒体等多场景。提供续写、改写、润色等功能,助力创作者高效优化写作流程。界面简洁,功能全面,适合各类写作者提升内容品质和工作效率。
字节跳动发布的AI编程神器IDE
Trae是一种自适应的集成开发环境(IDE),通过自动化和多元协作改变开发流程。利用Trae,团队能够更快速、精确地编写和部署代码,从而提高编程效率和项目交付速度。Trae具备上下文感知和代码自动完成功能,是提升开发效率的理想工具。