Repository navigation
Quick Start
quyvu edited this page Oct 13, 2026
·
2 revisions
Get up and running with FxMap in under 5 minutes using FluentAPI-based configuration.
1
dotnet add package FxMap
dotnet add package FxMap.EntityFrameworkCore
dotnet add package FxMap.RabbitMq2
A distributed key is the shared contract between the entity config and the DTO profile:
public sealed class UserDistributedKey : IDistributedKey;3
Use EntityConfigureOf<T> to expose entity data:
public class UserConfig : EntityConfigureOf<User>
{
protected override void Configure()
{
Id(x => x.Id);
DefaultProperty(x => x.Name);
UseDistributedKey<UserDistributedKey>();
ExposedName(x => x.Email, "UserEmail");
}
}4
Use ProfileOf<T> to declare which properties to auto-populate:
public class UserResponseProfile : ProfileOf<UserResponse>
{
protected override void Configure()
{
UseDistributedKey<UserDistributedKey>()
.Of(x => x.UserId)
.For(x => x.UserName)
.For(x => x.UserEmail, "UserEmail");
}
}5
Configure FxMap in Program.cs:
builder.Services.AddFxMap(cfg =>
{
cfg.AddEntitiesFromAssemblyContaining<SomeEntityAssemblyMarker>();
cfg.AddProfilesFromAssemblyContaining<SomeProfileAssemblyMarker>();
cfg.AddRabbitMq(config =>
{
config.Host("localhost", "/", 5672, c =>
{
c.UserName("guest");
c.Password("guest");
});
});
})
.AddEntityFrameworkCore(options =>
options.AddDbContexts(typeof(AppDbContext)));6
Inject IDistributedMapper and call MapDataAsync:
var response = new UserResponse { UserId = "user-123" };
// FxMap auto-populates all declared properties
await mapper.MapDataAsync(response);
Console.WriteLine(response.UserName); // "John Doe"
Console.WriteLine(response.UserEmail); // "john@example.com"FxMap will automatically:
- Discover all EntityConfigureOf and ProfileOf classes in the registered assemblies
- Batch all lookups for the same distributed key into a single request
- Populate all declared profile properties using compiled expressions
Source: https://fxmapper.net/docs/quick-start/ — the website is always the most up to date version.
Introduction
Getting Started
Configuration
- Service Registration
- Entities & Profiles
- Handlers
- Pipelines
- Strongly Typed IDs
- Error Handling
- Retry Policy
- Supervisor
- Telemetry
- Kestrel (HTTP/2)
- Analyzers
Expressions
- Overview
- Property Access
- Filters, Sorting & Paging
- Functions
- Aggregations
- Projections
- Coalesce & Ternary
- GroupBy
Data Providers
Transports
Integrations
Quality
AI Assistants
Migration
Release Notes