Entity Database
for .NET
Not a key-value store. Real objects, real queries.
LINQ, trees, aggregations, window functions — native SQL.
$ dotnet new install redb.Templates && dotnet new redb -n MyApp// Define your model [RedbScheme] public class Product { public string Name { get; set; } public decimal Price { get; set; } public Category Category { get; set; } // Nested! } // Query with full LINQ await redb.Query<Product>() .Where(p => p.Price < 100) .Where(p => p.Category.Name == "Electronics") .OrderBy(p => p.Name) .ToListAsync();
Why RedBase?
Strong Typing
Real C# classes with IntelliSense. Compile-time checks. Full refactoring. No magic strings.
Tree Structures
Hierarchical data as first-class citizen. Ancestors, descendants — optimized CTE queries.
Full LINQ
Where, OrderBy, GroupBy, Take, Skip, Any, All, Count — all compiled to native SQL.
Analytics
GroupBy, Sum, Avg, Min, Max. Window functions: RowNumber, Rank, Lag, Lead.
Zero Migrations
Code-first sync. Add a property — database updates automatically. No scripts.
Enterprise Ready
PostgreSQL, SQL Server & SQLite. Caching, change tracking, computed expressions.
Write Less. Query More.
No more Include chains. No N+1 problems.
// Nested objects = Include chains var dbOrders = await context.Orders .Include(o => o.Customer) .Include(o => o.Items) .ThenInclude(i => i.Product) .ThenInclude(p => p.Category) .Include(o => o.Shipping) .ThenInclude(s => s.Address) .Where(o => o.Status == "Active") .ToListAsync(); // Then map to business objects... var orders = dbOrders.Select(MapToOrder); // 6 JOINs, N+1 risk, manual mapping
// Query business objects directly var orders = await redb .Query<Order>() .Where(o => o.Status == "Active") .Where(o => o.Customer.Country == "US") .ToListAsync(); // Business entities ready to use // No DB models. No mapping. // No Include. Compile-time safe.
Real SQL. Real Power.
Built on PostgreSQL, SQL Server & SQLite — from a single embedded file to enterprise servers.
Full Relational Power
Indexes, foreign keys, transactions, constraints, triggers — everything your SQL server provides. No limitations.
ACID Transactions
Real database transactions with rollback support. Not eventual consistency — immediate, reliable, battle-tested.
Native SQL Performance
Queries compile to optimized SQL. Use EXPLAIN ANALYZE. Add indexes where needed. No black box.
Strong Typing
C# classes with IntelliSense. Compile-time checks. Refactoring works. No magic strings, no runtime surprises.
Custom SQL When Needed
Write raw SQL for complex cases. Mix LINQ and SQL freely. Full control when you need it.
Better Than NoSQL
Flexibility of document stores + power of SQL. Nested objects without JSON parsing. Real queries, not map-reduce.
Perfect For
From simple projects to enterprise systems — one approach for all.
Easy SQL Integration
Have existing SQL database? Just connect, describe your classes, and start working. No migrations, no schema changes. Evolve gradually.
Stored Procedures & Functions
Use your existing library of SQL functions. Create custom procedures. Call them directly from LINQ. Full SQL power in C# code.
IoT & Telemetry
Sensors, devices, controllers — store as RedBase objects. Create your own partitioned trend tables for time-series data. Link via FK to _objects. Best of both worlds.
Identity & IAM
Users, roles, permissions, claims, policies, audit logs. Instead of 20+ ASP.NET Identity tables — just C# classes. Typed, refactorable, simple.
CRM & Business Apps
Contacts, companies, deals, products. Each industry needs different fields. Add custom attributes without ALTER TABLE. Flexible like spreadsheet, typed like code.
No-Code & Builders
Website builders, CMS, form builders. Users create entity types at runtime. You just save objects — no schema generation, no code generation.
Simple Projects
Blog, catalog, portfolio site? Define classes, save objects, query with LINQ. Database ready in minutes. Scale when needed.
Medical & ERP
Hundreds of entity types: patients, diagnoses, tests, equipment, orders. Traditional approach = hundreds of tables. RedBase = just C# classes.
E-commerce
Clothes have size & color. Electronics have specs. Food has expiry. Each category — different attributes. One codebase, no schema per category.
Database Portability
Export to .redb file, import to any supported database. PostgreSQL today, SQL Server tomorrow. One backup format, zero vendor lock-in. CLI tool included.
Future Engines
PostgreSQL & SQL Server today. Oracle, MySQL, SQLite, ClickHouse — on the roadmap. Your code stays the same. Switch engines without rewriting queries.
Cloud & MPP Ready
SQL Server → Azure SQL. PostgreSQL → Aurora, AlloyDB, Citus. GreenPlum compatibility in research. Same code, change connection string — on-prem to cloud in minutes.
.NET Native
Built for .NET developers. Works with C#, F#, VB.NET — any .NET language.
Cross-Platform
Windows, Linux, macOS, Docker, Kubernetes. .NET 8+ with AOT support. Deploy anywhere — same binary.
Debug & Transparency
ToSqlString() on any query — see exact SQL before execution. No black box. Use EXPLAIN ANALYZE. Profile like native SQL.
Parallel Processing
Parallel.ForEach for materialization. Parallel tree diff. Bulk operations. Scales to all CPU cores. 100K+ objects/sec.
Full LINQ Support
Where, Select, OrderBy, GroupBy, Any, All, Count, Take, Skip — everything works. Not a subset. Real LINQ, real power.
Dependency Injection
Standard IServiceCollection. AddRedb() and done. Scoped services, proper lifetime. ASP.NET Core, Blazor, MAUI — native integration.
100% Async
Every operation is async/await. No blocking calls. Perfect for high-load web apps, real-time services, microservices.
Strong Typing
IntelliSense for all properties. Compile-time checks. Refactoring works across codebase. No magic strings, no surprises.
NuGet Ready
dotnet add package redb.Postgres — start coding in seconds. Open source core free forever. Pro packages for enterprise needs.
Engine-Specific SQL
LINQ compiles to optimized SQL for PostgreSQL or SQL Server. Not generic SQL — native syntax, native functions, native performance.
RedBase — Native Object Database on SQL
Object-native. SQL-powered.
Store C# objects directly using PostgreSQL or SQL Server as the engine.
No migrations. Full LINQ. SQL access when you need it.
Start building today
Free open source core. Pro features for enterprise needs.
Latest releases
- A Pro list call makes fewer round trips: two on SQL Server and PostgreSQL (four before), three on SQLite (four before). The type table is read once per datab…
- x.Tags != null && x.Tags.Contains(v) runs as the Contains alone on the Pro providers. The null guard of an array is dropped when the same AND chain already r…
- SQL Server Pro: GroupByArray over two or more fields of an array element joins them with hash joins when it reads many elements. Without a condition, and wit…
- SQL Server Pro runs a GroupBy over the whole scheme with hash joins. With the query planner on and no condition at all, a grouping that reads two or more fie…
- A dictionary read from the database lists its entries by key, the same on every provider. Strings sort
- Reading rows into objects (QueryAsync<T> of redb.Context, and the props loading built on it) now matches each column to its property once per result set and…
- Pro: loading a page of objects allocates about 45% less memory. The values of a read are indexed once, and the materializer no longer goes through reflection…
- AllAsync with one condition on a plain field and no Where no longer counts every object of the scheme twice on SQL Server Pro and SQLite Pro. It first looks…
- TimeSpan and TimeOnly are stored as their ticks in a number column, so they compare, sort, group and take Min/Max
- RedbSchemaNewerException. Thrown at start-up when the database carries a newer redb module that does not serve this
- Pro: Where(p => p.Lines.Any(l => l.Kind == "a" && l.Active)) over an array or a list of classes. All conditions
- Tools can judge the schema version themselves and stop with the same exceptions as the start-up.