Repository navigation
Data Providers Overview
FxMap data providers enable seamless integration with different database technologies, allowing you to fetch and map data efficiently.
Data providers are FxMap extensions that connect your FluentAPI-based entity configs and profiles to actual database systems. They handle query generation, execution, and result mapping automatically.
-
Profile Analysis: FxMap analyzes your ProfileOf configs and expressions to understand what data needs to be fetched
-
Query Generation: The data provider translates expressions into optimized database queries
-
Execution: Queries are executed against the database with proper optimization and batching
-
Mapping: Results are automatically mapped to your DTO properties using compiled expressions
For SQL databases including SQL Server, PostgreSQL, MySQL, and SQLite. Translates FxMap expressions to optimized SQL queries with proper JOINs.
SQL query optimization
Automatic JOIN generation
Change tracking support
For NoSQL document databases. Leverages MongoDB's aggregation pipeline to efficiently fetch and transform data based on your expressions.
Aggregation pipelines
Document projection
Collection lookups
Configuring a data provider is straightforward - add it to your FxMap setup in Program.cs:
builder.Services.AddFxMap(cfg =>
{
cfg.AddEntitiesFromAssemblyContaining<SomeEntityAssemblyMarker>();
cfg.AddProfilesFromAssemblyContaining<SomeProfileAssemblyMarker>();
})
.AddEntityFrameworkCore(options => options.AddDbContexts(typeof(AppDbContext)));builder.Services.AddFxMap(cfg =>
{
cfg.AddEntitiesFromAssemblyContaining<SomeEntityAssemblyMarker>();
cfg.AddProfilesFromAssemblyContaining<SomeProfileAssemblyMarker>();
})
.AddMongoDb(cfg => cfg.AddCollection(userCollection).AddCollection(orderCollection));Both providers generate optimized queries. EF Core produces efficient SQL with proper indexes and JOINs. MongoDB leverages aggregation pipelines with $lookup and $unwind for optimal document retrieval.
FxMap automatically batches multiple related queries and caches results within a request scope, minimizing database round-trips and improving performance.
All FxMap expressions are compiled to optimized code at startup, not using slow reflection at runtime. This results in 10x faster performance compared to traditional mapping approaches.
| Scenario | Recommended Provider |
|---|---|
| Relational data with complex joins | Entity Framework Core |
| Document-oriented data | MongoDB |
| Existing EF Core application | Entity Framework Core |
| Schema-less flexible data | MongoDB |
| Transaction support required | Entity Framework Core |
Source: https://fxmapper.net/docs/data-providers/ — 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