OfX 8.2.5
dotnet add package OfX --version 8.2.5
NuGet\Install-Package OfX -Version 8.2.5
<PackageReference Include="OfX" Version="8.2.5" />
<PackageVersion Include="OfX" Version="8.2.5" />
<PackageReference Include="OfX" />
paket add OfX --version 8.2.5
#r "nuget: OfX, 8.2.5"
#:package OfX@8.2.5
#addin nuget:?package=OfX&version=8.2.5
#tool nuget:?package=OfX&version=8.2.5
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:
- Getting Started Guide
- Configuration Options
- Expression Language Reference
- Data Provider Setup
- Transport Configuration
- API Reference
Contributing
Contributions are welcome! Please visit our GitHub repository to:
- Report issues
- Submit pull requests
- Request features
License
This project is licensed under the Apache-2.0 license.
| Product | Versions 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. |
-
net8.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Hosting.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Logging (>= 8.0.0)
-
net9.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Hosting.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Logging (>= 8.0.0)
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.5 | 39 | 1/24/2026 | |
| 8.2.4 | 282 | 1/19/2026 | |
| 8.2.3 | 215 | 1/18/2026 | |
| 8.2.2 | 324 | 1/18/2026 | |
| 8.2.1 | 223 | 1/17/2026 | |
| 8.2.0 | 208 | 1/17/2026 | |
| 8.1.2 | 355 | 1/13/2026 | |
| 8.1.1 | 211 | 1/13/2026 | |
| 8.1.0 | 216 | 1/11/2026 | |
| 8.0.0 | 372 | 1/3/2026 | |
| 7.2.2 | 478 | 12/18/2025 | |
| 7.2.1 | 751 | 12/1/2025 | |
| 7.2.0 | 563 | 11/18/2025 | |
| 7.2.0-preview | 547 | 11/18/2025 | |
| 7.1.10 | 340 | 10/20/2025 | |
| 7.1.9 | 316 | 10/17/2025 | |
| 7.1.8 | 325 | 10/15/2025 | |
| 7.1.7 | 329 | 10/15/2025 | |
| 7.1.6 | 320 | 10/7/2025 | |
| 7.1.5 | 294 | 10/5/2025 | |
| 7.1.4 | 304 | 9/24/2025 | |
| 7.1.3 | 306 | 9/23/2025 | |
| 7.1.2 | 315 | 9/23/2025 | |
| 7.1.1 | 341 | 8/28/2025 | |
| 7.1.0 | 295 | 8/13/2025 | |
| 7.0.6 | 372 | 8/7/2025 | |
| 7.0.5 | 366 | 8/6/2025 | |
| 7.0.4 | 287 | 8/4/2025 | |
| 7.0.3 | 236 | 7/4/2025 | |
| 7.0.2 | 346 | 6/19/2025 | |
| 7.0.1 | 306 | 6/19/2025 | |
| 7.0.0 | 395 | 6/9/2025 | |
| 6.0.2 | 438 | 5/26/2025 | |
| 6.0.1 | 324 | 5/25/2025 | |
| 6.0.0 | 316 | 5/20/2025 | |
| 6.0.0-beta1 | 297 | 5/20/2025 | |
| 5.0.22 | 356 | 5/5/2025 | |
| 5.0.21 | 1,173 | 4/26/2025 | |
| 5.0.20 | 271 | 4/26/2025 | |
| 5.0.19 | 592 | 4/22/2025 | |
| 5.0.18 | 424 | 4/13/2025 | |
| 5.0.17 | 929 | 3/23/2025 | |
| 5.0.16 | 950 | 3/18/2025 | |
| 5.0.15 | 327 | 3/17/2025 | |
| 5.0.14 | 607 | 3/9/2025 | |
| 5.0.13 | 541 | 3/6/2025 | |
| 5.0.12 | 461 | 3/6/2025 | |
| 5.0.11 | 483 | 3/2/2025 | |
| 5.0.10 | 339 | 2/28/2025 | |
| 5.0.9 | 311 | 2/28/2025 | |
| 5.0.8 | 307 | 2/28/2025 | |
| 5.0.7 | 293 | 2/27/2025 | |
| 5.0.6 | 272 | 2/26/2025 | |
| 5.0.5 | 260 | 2/24/2025 | |
| 5.0.4 | 301 | 2/21/2025 | |
| 5.0.3 | 250 | 2/21/2025 | |
| 5.0.2 | 293 | 2/19/2025 | |
| 5.0.1 | 277 | 2/18/2025 | |
| 5.0.0 | 267 | 2/17/2025 | |
| 4.1.3 | 272 | 2/11/2025 | |
| 4.1.2 | 281 | 2/11/2025 | |
| 4.1.1 | 248 | 2/9/2025 | |
| 4.1.0 | 261 | 2/8/2025 | |
| 4.0.1 | 264 | 2/6/2025 | |
| 4.0.0 | 246 | 2/4/2025 | |
| 3.3.3 | 229 | 2/4/2025 | |
| 3.3.2 | 272 | 2/3/2025 | |
| 3.3.1 | 273 | 2/1/2025 | |
| 3.3.0 | 275 | 1/22/2025 | |
| 3.2.1 | 237 | 1/22/2025 | |
| 3.2.0 | 224 | 1/21/2025 | |
| 3.1.13 | 260 | 1/18/2025 | |
| 3.1.12 | 259 | 1/16/2025 | |
| 3.1.11 | 252 | 1/13/2025 | |
| 3.1.10 | 216 | 1/12/2025 | |
| 3.1.9 | 212 | 1/10/2025 | |
| 3.1.8 | 248 | 1/8/2025 | |
| 3.1.7 | 241 | 1/7/2025 | |
| 3.1.6 | 233 | 1/6/2025 | |
| 3.1.5 | 211 | 1/5/2025 | |
| 3.1.4 | 252 | 1/4/2025 | |
| 3.1.3 | 219 | 1/4/2025 | |
| 3.1.2 | 269 | 1/4/2025 | |
| 3.1.1 | 264 | 1/3/2025 | |
| 3.1.0 | 234 | 12/31/2024 | |
| 3.0.5 | 208 | 12/30/2024 | |
| 3.0.4 | 205 | 12/30/2024 | |
| 3.0.3 | 214 | 12/30/2024 | |
| 3.0.2 | 224 | 12/30/2024 | |
| 3.0.1 | 213 | 12/30/2024 | |
| 3.0.0 | 197 | 12/30/2024 | |
| 2.0.3 | 235 | 12/30/2024 | |
| 2.0.2 | 216 | 12/29/2024 | |
| 2.0.1 | 211 | 12/29/2024 | |
| 2.0.0 | 221 | 12/28/2024 | |
| 1.1.4 | 189 | 12/27/2024 | |
| 1.1.3 | 224 | 12/26/2024 | |
| 1.1.2 | 221 | 12/26/2024 | |
| 1.1.1 | 228 | 12/26/2024 | |
| 1.1.0 | 191 | 12/25/2024 | |
| 1.0.8 | 211 | 12/25/2024 | |
| 1.0.7 | 217 | 12/25/2024 | |
| 1.0.6 | 221 | 12/25/2024 | |
| 1.0.5 | 181 | 12/24/2024 | |
| 1.0.4 | 194 | 12/24/2024 | |
| 1.0.3 | 166 | 12/24/2024 | |
| 1.0.2 | 206 | 12/24/2024 | |
| 1.0.1 | 199 | 12/24/2024 | |
| 1.0.0 | 191 | 12/23/2024 |