FreeSql is a .NET O/RM that supports CodeFirst migrations, DbFirst scaffolding, navigation properties, and many SQL and analytical database providers.
Overview
FreeSql targets VB.NET and C# projects that need a single data access layer across many database engines. It advertises support for common open-source and commercial databases, including relational engines, embedded SQLite, analytical stores, and several China-native systems listed in its documentation.
Developers can work in several styles: direct FreeSql APIs, a DbContext with repositories and unit-of-work, or a simplified BaseEntity mode. CodeFirst can sync schema from entities; DbFirst can import models from an existing database or a generation tool.
The library covers querying, inserts, updates, and deletes with expression helpers, lazy or eager loading for relationships, read/write splitting, sharded tables and databases, global filters, and optimistic or pessimistic locking. Optional packages add provider-specific drivers via NuGet, and a separate Repository package layers transactional patterns for ASP.NET Core.
Documentation and community chat groups are referenced for onboarding; performance comparisons against Dapper appear in project materials.
Key features
- CodeFirst schema migration
- DbFirst entity import
- Many database provider packages
- Navigation and lazy loading
- Read/write split and sharding
- Repository and unit-of-work mode
- AOT-capable builds
- Bulk copy style operations
Use cases
- Multi-database .NET applications
- CodeFirst microservices data layers
- Legacy DbFirst model generation
- Cross-provider enterprise deployments
- High-throughput bulk data writes