OfX

The Open-Source Attribute-based Mapping Engine for .NET Ecosystem

OfX streamlines data transformation between services in your microservices architecture. Efficient, extensible, and built for maintainability.

What is OfX?

OfX is a lightweight, high-performance, attribute-based data mapping engine designed for the .NET ecosystem. Built to empower developers to manage data transformations across services with clarity, speed, and scalability.

Video Introductions

Designed for Developers

OfX prioritizes developer experience. With minimal setup and an intuitive attribute system, you can map complex data models effortlessly, enabling fast iteration, easy maintenance, and powerful extensibility.

Built for Real-World Systems

From microservices communication to event-driven architectures, OfX is engineered to support high-load, scalable distributed systems with precision and performance.

Why OfX?

Attribute Mapping

Use attributes to map data clearly between services, models, or APIs without complex configurations.

Modular Integration

Works out of the box with Entity Framework, MongoDB, GraphQL (HotChocolate), gRPC, Kafka, RabbitMQ, NATS, and more.

High Performance

Built with caching and reflection optimization to handle large volumes of data with minimal overhead.

Extensible by Design

Easily extend or customize how mappings behave or how services communicate with minimal effort.

Quick Start Guide

OfX is available on NuGet. Install with .NET CLI:

dotnet add package OfX

Configure OfX in your application:

builder.Services.AddOfX(cfg =>
{
    cfg.AddContractsContainNamespaces(typeof(SomeContractAssemblyMarker).Assembly);
    cfg.AddNats(config => config.Url("nats://localhost:4222")); // Or gRPC, RabbitMq, Kafka, Nats
});

Define a custom OfXAttribute:

public sealed class UserOfAttribute(string propertyName) : OfXAttribute(propertyName);

Tell OfX which model the attribute applies to:


[OfXConfigFor<UserOfAttribute>(nameof(Id), nameof(Name))]
public sealed class User
{
    public string Id { get; set; } 
    public string Name { get; set; } 
    public string Email { get; set; } 
    // Add other properties as needed
}

Use attributes to enrich your model:

public sealed class SomeDataResponse
{
    public string Id { get; set; }
    public string UserId { get; set; }
    
    [UserOf(nameof(UserId), Expression = "Email")]
    public string UserEmail { get; set; }
    
    [UserOf(nameof(UserId))]
    public string UserName { get; set; }
}

Learn More

Start Building with OfX