Relational Db

FlexBase provides flexible options for working with relational databases, supporting both full-featured ORM (Entity Framework Core) and high-performance micro-ORM (Dapper/Flex MicroORM) approaches.

Available Options

Option
Description
Best For

Full-featured ORM with change tracking, LINQ queries, and migrations

Complex domain models, navigation properties, automatic change tracking

High-performance micro-ORM with provider-agnostic abstractions

High-performance reads, bulk operations, complex SQL queries

Quick Comparison

Feature
EF Core
Dapper

Performance

Good

Excellent

Abstraction Level

High

Low

Change Tracking

✅ Automatic

❌ Manual

LINQ Support

✅ Full

❌ Raw SQL

Migrations

✅ Built-in

❌ Manual

Navigation Properties

✅ Lazy/Eager loading

❌ Manual mapping

Learning Curve

Moderate

Minimal

Bulk Operations

Good

Excellent

Supported Database Providers

Both EF Core and Dapper support multiple database providers:

  • SQL Server (default)

  • PostgreSQL

  • MySQL / MariaDB

  • SQLite

  • Oracle

When to Use Each

Use Entity Framework Core when:

  • You have complex domain models with relationships

  • You need automatic change tracking

  • You want to use LINQ for type-safe queries

  • You need automatic database migrations

  • You prefer higher-level abstractions

Use Dapper when:

  • Performance is critical

  • You're comfortable with SQL

  • You need to execute complex, optimized queries

  • You're doing bulk operations

  • You want minimal overhead

Can I Use Both?

Yes! Many applications use both:

  • EF Core for complex domain models and transactional operations

  • Dapper for high-performance read queries and reporting

FlexBase Integration

Both approaches integrate seamlessly with FlexBase features:

  • Provider-agnostic SQL - Use ProviderSqlMap to write database-specific queries

  • Async query extensions - Use *AsyncFlex methods that work across both

  • Soft delete filtering - Automatic filtering of soft-deleted records

  • Audit trail - Automatic audit logging of changes

  • Multi-database support - Switch providers without code changes

Getting Started

  1. Choose your approach (or use both)

  2. Follow the specific guide:

  3. Configure your database provider

  4. Start building!

See Also

Last updated