OfX 8.2.2

There is a newer version of this package available.
See the version list below for details.
dotnet add package OfX --version 8.2.2
                    
NuGet\Install-Package OfX -Version 8.2.2
                    
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="OfX" Version="8.2.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="OfX" Version="8.2.2" />
                    
Directory.Packages.props
<PackageReference Include="OfX" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add OfX --version 8.2.2
                    
#r "nuget: OfX, 8.2.2"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package OfX@8.2.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=OfX&version=8.2.2
                    
Install as a Cake Addin
#tool nuget:?package=OfX&version=8.2.2
                    
Install as a Cake Tool

OfX

public string XId { get; set; }
[XOf(nameof(XId))] public string X { get; set; }

OfX is an open-source library focused on Attribute-based data mapping. It streamlines data handling across services, reduces boilerplate code, and improves maintainability.

Full Documentation | Getting Started |Expression Language

All OfX* packages need to have the same version.

Quick Start

dotnet add package OfX
// 1. Configure OfX
builder.Services.AddOfX(cfg =>
{
    cfg.AddAttributesContainNamespaces(typeof(UserOfAttribute).Namespace!);
    cfg.AddModelConfigurationsFromNamespaceContaining<SomeModelAssemblyMarker>();
});

// 2. Define a custom OfXAttribute
public sealed class UserOfAttribute(string propertyName) : OfXAttribute(propertyName);

// 3. Configure the model
[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; }
}

// 4. Use attributes in your DTOs
public sealed class SomeDataResponse
{
    public string UserId { get; set; }

    [UserOf(nameof(UserId))]
    public string UserName { get; set; }

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

Key Features

  • Attribute-based Mapping: Declarative data fetching using custom attributes
  • Powerful Expression Language: SQL-like DSL for complex queries, filtering, aggregation, and projections
  • Multiple Data Providers: Support for EF Core, MongoDB, and more
  • Multiple Transports: gRPC, NATS, RabbitMQ, Kafka, Azure Service Bus
  • GraphQL Integration: Seamless integration with HotChocolate

Expression Examples

// Simple property access
[UserOf(nameof(UserId), Expression = "Email")]
public string UserEmail { get; set; }

// Navigation properties
[ProvinceOf(nameof(ProvinceId), Expression = "Country.Name")]
public string CountryName { get; set; }

// Filtering
[UserOf(nameof(UserId), Expression = "Orders(Status = 'Done')")]
public List<OrderDTO> CompletedOrders { get; set; }

// Aggregation
[UserOf(nameof(UserId), Expression = "Orders:sum(Total)")]
public decimal TotalSpent { get; set; }

// Projection
[UserOf(nameof(UserId), Expression = "{Id, Name, Address.City as CityName}")]
public UserInfo UserDetails { get; set; }

// GroupBy
[UserOf(nameof(UserId), Expression = "Orders:groupBy(Status).{Status, :count as Count}")]
public List<OrderSummary> OrdersByStatus { get; set; }

For complete expression syntax including filters, indexers, functions, aggregations, boolean functions, coalesce, ternary operators, and more, visit Expression Documentation.

Packages

Package Description .NET
Core
OfX Core library 8.0, 9.0
Data Providers
OfX-EFCore Entity Framework Core provider 8.0, 9.0
OfX-MongoDb MongoDB provider 8.0, 9.0
Integrations
OfX-HotChocolate HotChocolate GraphQL integration 8.0, 9.0
Transports
OfX-gRPC gRPC transport 8.0, 9.0
OfX-Nats NATS transport 8.0, 9.0
OfX-RabbitMq RabbitMQ transport 8.0, 9.0
OfX-Kafka Kafka transport 8.0, 9.0
OfX-Azure.ServiceBus Azure Service Bus transport 8.0, 9.0

Documentation

Visit ofxmapper.net for:

Contributing

Contributions are welcome! Please visit our GitHub repository to:

  • Report issues
  • Submit pull requests
  • Request features

License

This project is licensed under the MIT License.


Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (9)

Showing the top 5 NuGet packages that depend on OfX:

Package Downloads
OfX-EFCore

OfX extension. Use EntityFramework as Data Querying

OfX-Nats

Nats.io extension. Use Nats as Data transporting

OfX-gRPC

OfX extension. Use gRPC as Data transporting

OfX-RabbitMq

OfX-RabbitMq extension. Use RabbitMq as Data transporting

OfX-Kafka

OfX-Kafka extension. Use Kafka as Data transporting

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
8.2.6 162 1/28/2026
8.2.5 215 1/24/2026
8.2.4 597 1/19/2026
8.2.3 217 1/18/2026
8.2.2 326 1/18/2026
8.2.1 225 1/17/2026
8.2.0 210 1/17/2026
8.1.2 359 1/13/2026
8.1.1 214 1/13/2026
8.1.0 218 1/11/2026
8.0.0 374 1/3/2026
7.2.2 481 12/18/2025 7.2.2 is deprecated because it is no longer maintained.
7.2.1 757 12/1/2025 7.2.1 is deprecated because it is no longer maintained.
7.2.0 566 11/18/2025 7.2.0 is deprecated because it is no longer maintained.
7.2.0-preview 548 11/18/2025 7.2.0-preview is deprecated because it is no longer maintained.
7.1.10 343 10/20/2025 7.1.10 is deprecated because it is no longer maintained.
7.1.9 320 10/17/2025 7.1.9 is deprecated because it is no longer maintained.
7.1.8 329 10/15/2025 7.1.8 is deprecated because it is no longer maintained.
7.1.7 334 10/15/2025 7.1.7 is deprecated because it is no longer maintained.
7.1.6 327 10/7/2025 7.1.6 is deprecated because it is no longer maintained.
7.1.5 297 10/5/2025 7.1.5 is deprecated because it is no longer maintained.
7.1.4 308 9/24/2025 7.1.4 is deprecated because it is no longer maintained.
7.1.3 309 9/23/2025 7.1.3 is deprecated because it is no longer maintained.
7.1.2 320 9/23/2025 7.1.2 is deprecated because it is no longer maintained.
7.1.1 347 8/28/2025 7.1.1 is deprecated because it is no longer maintained.
7.1.0 299 8/13/2025 7.1.0 is deprecated because it is no longer maintained.
7.0.6 377 8/7/2025 7.0.6 is deprecated because it is no longer maintained.
7.0.5 372 8/6/2025 7.0.5 is deprecated because it is no longer maintained.
7.0.4 290 8/4/2025 7.0.4 is deprecated because it is no longer maintained.
7.0.3 244 7/4/2025 7.0.3 is deprecated because it is no longer maintained.
7.0.2 351 6/19/2025 7.0.2 is deprecated because it is no longer maintained.
7.0.1 308 6/19/2025 7.0.1 is deprecated because it is no longer maintained.
7.0.0 398 6/9/2025 7.0.0 is deprecated because it is no longer maintained.
6.0.2 443 5/26/2025 6.0.2 is deprecated because it is no longer maintained.
6.0.1 328 5/25/2025 6.0.1 is deprecated because it is no longer maintained.
6.0.0 318 5/20/2025 6.0.0 is deprecated because it is no longer maintained.
6.0.0-beta1 299 5/20/2025 6.0.0-beta1 is deprecated because it is no longer maintained.
5.0.22 360 5/5/2025 5.0.22 is deprecated because it is no longer maintained.
5.0.21 1,177 4/26/2025 5.0.21 is deprecated because it is no longer maintained.
5.0.20 278 4/26/2025 5.0.20 is deprecated because it is no longer maintained.
5.0.19 600 4/22/2025 5.0.19 is deprecated because it is no longer maintained.
5.0.18 428 4/13/2025 5.0.18 is deprecated because it is no longer maintained.
5.0.17 932 3/23/2025 5.0.17 is deprecated because it is no longer maintained.
5.0.16 959 3/18/2025 5.0.16 is deprecated because it is no longer maintained.
5.0.15 329 3/17/2025 5.0.15 is deprecated because it is no longer maintained.
5.0.14 612 3/9/2025 5.0.14 is deprecated because it is no longer maintained.
5.0.13 544 3/6/2025 5.0.13 is deprecated because it is no longer maintained.
5.0.12 463 3/6/2025 5.0.12 is deprecated because it is no longer maintained.
5.0.11 490 3/2/2025 5.0.11 is deprecated because it is no longer maintained.
5.0.10 345 2/28/2025 5.0.10 is deprecated because it is no longer maintained.
5.0.9 313 2/28/2025 5.0.9 is deprecated because it is no longer maintained.
5.0.8 311 2/28/2025 5.0.8 is deprecated because it is no longer maintained.
5.0.7 297 2/27/2025 5.0.7 is deprecated because it is no longer maintained.
5.0.6 275 2/26/2025 5.0.6 is deprecated because it is no longer maintained.
5.0.5 264 2/24/2025 5.0.5 is deprecated because it is no longer maintained.
5.0.4 306 2/21/2025 5.0.4 is deprecated because it is no longer maintained.
5.0.3 254 2/21/2025 5.0.3 is deprecated because it is no longer maintained.
5.0.2 298 2/19/2025 5.0.2 is deprecated because it is no longer maintained.
5.0.1 280 2/18/2025 5.0.1 is deprecated because it is no longer maintained.
5.0.0 270 2/17/2025 5.0.0 is deprecated because it is no longer maintained.
4.1.3 275 2/11/2025 4.1.3 is deprecated because it is no longer maintained.
4.1.2 285 2/11/2025 4.1.2 is deprecated because it is no longer maintained.
4.1.1 253 2/9/2025 4.1.1 is deprecated because it is no longer maintained.
4.1.0 265 2/8/2025 4.1.0 is deprecated because it is no longer maintained.
4.0.1 270 2/6/2025 4.0.1 is deprecated because it is no longer maintained.
4.0.0 249 2/4/2025 4.0.0 is deprecated because it is no longer maintained.
3.3.3 231 2/4/2025 3.3.3 is deprecated because it is no longer maintained.
3.3.2 276 2/3/2025 3.3.2 is deprecated because it is no longer maintained.
3.3.1 277 2/1/2025 3.3.1 is deprecated because it is no longer maintained.
3.3.0 279 1/22/2025 3.3.0 is deprecated because it is no longer maintained.
3.2.1 243 1/22/2025 3.2.1 is deprecated because it is no longer maintained.
3.2.0 227 1/21/2025 3.2.0 is deprecated because it is no longer maintained.
3.1.13 266 1/18/2025 3.1.13 is deprecated because it is no longer maintained.
3.1.12 262 1/16/2025 3.1.12 is deprecated because it is no longer maintained.
3.1.11 256 1/13/2025 3.1.11 is deprecated because it is no longer maintained.
3.1.10 221 1/12/2025 3.1.10 is deprecated because it is no longer maintained.
3.1.9 217 1/10/2025 3.1.9 is deprecated because it is no longer maintained.
3.1.8 252 1/8/2025 3.1.8 is deprecated because it is no longer maintained.
3.1.7 244 1/7/2025 3.1.7 is deprecated because it is no longer maintained.
3.1.6 237 1/6/2025 3.1.6 is deprecated because it is no longer maintained.
3.1.5 214 1/5/2025 3.1.5 is deprecated because it is no longer maintained.
3.1.4 257 1/4/2025 3.1.4 is deprecated because it is no longer maintained.
3.1.3 225 1/4/2025 3.1.3 is deprecated because it is no longer maintained.
3.1.2 273 1/4/2025 3.1.2 is deprecated because it is no longer maintained.
3.1.1 267 1/3/2025 3.1.1 is deprecated because it is no longer maintained.
3.1.0 237 12/31/2024 3.1.0 is deprecated because it is no longer maintained.
3.0.5 212 12/30/2024 3.0.5 is deprecated because it is no longer maintained.
3.0.4 207 12/30/2024 3.0.4 is deprecated because it is no longer maintained.
3.0.3 219 12/30/2024 3.0.3 is deprecated because it is no longer maintained.
3.0.2 228 12/30/2024 3.0.2 is deprecated because it is no longer maintained.
3.0.1 219 12/30/2024 3.0.1 is deprecated because it is no longer maintained.
3.0.0 199 12/30/2024 3.0.0 is deprecated because it is no longer maintained.
2.0.3 241 12/30/2024 2.0.3 is deprecated because it is no longer maintained.
2.0.2 220 12/29/2024 2.0.2 is deprecated because it is no longer maintained.
2.0.1 216 12/29/2024 2.0.1 is deprecated because it is no longer maintained.
2.0.0 224 12/28/2024 2.0.0 is deprecated because it is no longer maintained.
1.1.4 194 12/27/2024 1.1.4 is deprecated because it is no longer maintained.
1.1.3 228 12/26/2024 1.1.3 is deprecated because it is no longer maintained.
1.1.2 224 12/26/2024 1.1.2 is deprecated because it is no longer maintained.
1.1.1 231 12/26/2024 1.1.1 is deprecated because it is no longer maintained.
1.1.0 196 12/25/2024 1.1.0 is deprecated because it is no longer maintained.
1.0.8 216 12/25/2024 1.0.8 is deprecated because it is no longer maintained.
1.0.7 221 12/25/2024 1.0.7 is deprecated because it is no longer maintained.
1.0.6 228 12/25/2024 1.0.6 is deprecated because it is no longer maintained.
1.0.5 185 12/24/2024 1.0.5 is deprecated because it is no longer maintained.
1.0.4 201 12/24/2024 1.0.4 is deprecated because it is no longer maintained.
1.0.3 168 12/24/2024 1.0.3 is deprecated because it is no longer maintained.
1.0.2 212 12/24/2024 1.0.2 is deprecated because it is no longer maintained.
1.0.1 204 12/24/2024 1.0.1 is deprecated because it is no longer maintained.
1.0.0 197 12/23/2024 1.0.0 is deprecated because it is no longer maintained.