OfX 8.2.4
dotnet add package OfX --version 8.2.4
NuGet\Install-Package OfX -Version 8.2.4
<PackageReference Include="OfX" Version="8.2.4" />
<PackageVersion Include="OfX" Version="8.2.4" />
<PackageReference Include="OfX" />
paket add OfX --version 8.2.4
#r "nuget: OfX, 8.2.4"
#:package OfX@8.2.4
#addin nuget:?package=OfX&version=8.2.4
#tool nuget:?package=OfX&version=8.2.4
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 MIT 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.4 | 157 | 1/19/2026 | |
| 8.2.3 | 170 | 1/18/2026 | |
| 8.2.2 | 235 | 1/18/2026 | |
| 8.2.1 | 183 | 1/17/2026 | |
| 8.2.0 | 168 | 1/17/2026 | |
| 8.1.2 | 353 | 1/13/2026 | |
| 8.1.1 | 210 | 1/13/2026 | |
| 8.1.0 | 214 | 1/11/2026 | |
| 8.0.0 | 370 | 1/3/2026 | |
| 7.2.2 | 475 | 12/18/2025 | |
| 7.2.1 | 749 | 12/1/2025 | |
| 7.2.0 | 561 | 11/18/2025 | |
| 7.2.0-preview | 544 | 11/18/2025 | |
| 7.1.10 | 338 | 10/20/2025 | |
| 7.1.9 | 314 | 10/17/2025 | |
| 7.1.8 | 324 | 10/15/2025 | |
| 7.1.7 | 326 | 10/15/2025 | |
| 7.1.6 | 319 | 10/7/2025 | |
| 7.1.5 | 293 | 10/5/2025 | |
| 7.1.4 | 303 | 9/24/2025 | |
| 7.1.3 | 304 | 9/23/2025 | |
| 7.1.2 | 313 | 9/23/2025 | |
| 7.1.1 | 338 | 8/28/2025 | |
| 7.1.0 | 292 | 8/13/2025 | |
| 7.0.6 | 370 | 8/7/2025 | |
| 7.0.5 | 364 | 8/6/2025 | |
| 7.0.4 | 285 | 8/4/2025 | |
| 7.0.3 | 234 | 7/4/2025 | |
| 7.0.2 | 344 | 6/19/2025 | |
| 7.0.1 | 305 | 6/19/2025 | |
| 7.0.0 | 392 | 6/9/2025 | |
| 6.0.2 | 436 | 5/26/2025 | |
| 6.0.1 | 321 | 5/25/2025 | |
| 6.0.0 | 313 | 5/20/2025 | |
| 6.0.0-beta1 | 295 | 5/20/2025 | |
| 5.0.22 | 352 | 5/5/2025 | |
| 5.0.21 | 1,171 | 4/26/2025 | |
| 5.0.20 | 269 | 4/26/2025 | |
| 5.0.19 | 589 | 4/22/2025 | |
| 5.0.18 | 418 | 4/13/2025 | |
| 5.0.17 | 926 | 3/23/2025 | |
| 5.0.16 | 947 | 3/18/2025 | |
| 5.0.15 | 325 | 3/17/2025 | |
| 5.0.14 | 606 | 3/9/2025 | |
| 5.0.13 | 540 | 3/6/2025 | |
| 5.0.12 | 460 | 3/6/2025 | |
| 5.0.11 | 478 | 3/2/2025 | |
| 5.0.10 | 338 | 2/28/2025 | |
| 5.0.9 | 308 | 2/28/2025 | |
| 5.0.8 | 304 | 2/28/2025 | |
| 5.0.7 | 291 | 2/27/2025 | |
| 5.0.6 | 271 | 2/26/2025 | |
| 5.0.5 | 258 | 2/24/2025 | |
| 5.0.4 | 300 | 2/21/2025 | |
| 5.0.3 | 246 | 2/21/2025 | |
| 5.0.2 | 292 | 2/19/2025 | |
| 5.0.1 | 275 | 2/18/2025 | |
| 5.0.0 | 265 | 2/17/2025 | |
| 4.1.3 | 269 | 2/11/2025 | |
| 4.1.2 | 280 | 2/11/2025 | |
| 4.1.1 | 246 | 2/9/2025 | |
| 4.1.0 | 260 | 2/8/2025 | |
| 4.0.1 | 263 | 2/6/2025 | |
| 4.0.0 | 244 | 2/4/2025 | |
| 3.3.3 | 226 | 2/4/2025 | |
| 3.3.2 | 269 | 2/3/2025 | |
| 3.3.1 | 272 | 2/1/2025 | |
| 3.3.0 | 273 | 1/22/2025 | |
| 3.2.1 | 233 | 1/22/2025 | |
| 3.2.0 | 223 | 1/21/2025 | |
| 3.1.13 | 257 | 1/18/2025 | |
| 3.1.12 | 257 | 1/16/2025 | |
| 3.1.11 | 248 | 1/13/2025 | |
| 3.1.10 | 214 | 1/12/2025 | |
| 3.1.9 | 210 | 1/10/2025 | |
| 3.1.8 | 246 | 1/8/2025 | |
| 3.1.7 | 239 | 1/7/2025 | |
| 3.1.6 | 231 | 1/6/2025 | |
| 3.1.5 | 209 | 1/5/2025 | |
| 3.1.4 | 247 | 1/4/2025 | |
| 3.1.3 | 217 | 1/4/2025 | |
| 3.1.2 | 265 | 1/4/2025 | |
| 3.1.1 | 263 | 1/3/2025 | |
| 3.1.0 | 230 | 12/31/2024 | |
| 3.0.5 | 206 | 12/30/2024 | |
| 3.0.4 | 202 | 12/30/2024 | |
| 3.0.3 | 213 | 12/30/2024 | |
| 3.0.2 | 222 | 12/30/2024 | |
| 3.0.1 | 211 | 12/30/2024 | |
| 3.0.0 | 195 | 12/30/2024 | |
| 2.0.3 | 233 | 12/30/2024 | |
| 2.0.2 | 214 | 12/29/2024 | |
| 2.0.1 | 208 | 12/29/2024 | |
| 2.0.0 | 220 | 12/28/2024 | |
| 1.1.4 | 188 | 12/27/2024 | |
| 1.1.3 | 221 | 12/26/2024 | |
| 1.1.2 | 220 | 12/26/2024 | |
| 1.1.1 | 225 | 12/26/2024 | |
| 1.1.0 | 189 | 12/25/2024 | |
| 1.0.8 | 205 | 12/25/2024 | |
| 1.0.7 | 216 | 12/25/2024 | |
| 1.0.6 | 219 | 12/25/2024 | |
| 1.0.5 | 179 | 12/24/2024 | |
| 1.0.4 | 192 | 12/24/2024 | |
| 1.0.3 | 165 | 12/24/2024 | |
| 1.0.2 | 201 | 12/24/2024 | |
| 1.0.1 | 196 | 12/24/2024 | |
| 1.0.0 | 187 | 12/23/2024 |