Ddap.Data.EntityFramework
1.0.0
See the version list below for details.
dotnet add package Ddap.Data.EntityFramework --version 1.0.0
NuGet\Install-Package Ddap.Data.EntityFramework -Version 1.0.0
<PackageReference Include="Ddap.Data.EntityFramework" Version="1.0.0" />
<PackageVersion Include="Ddap.Data.EntityFramework" Version="1.0.0" />
<PackageReference Include="Ddap.Data.EntityFramework" />
paket add Ddap.Data.EntityFramework --version 1.0.0
#r "nuget: Ddap.Data.EntityFramework, 1.0.0"
#:package Ddap.Data.EntityFramework@1.0.0
#addin nuget:?package=Ddap.Data.EntityFramework&version=1.0.0
#tool nuget:?package=Ddap.Data.EntityFramework&version=1.0.0
DDAP - Dynamic Data API Provider
DDAP (Dynamic Data API Provider) is a .NET 10 library that automatically generates REST, gRPC, and GraphQL APIs from your database schema. Load your database metadata at runtime and instantly expose your data through multiple API protocols.
Features
- 🚀 Automatic API Generation: Load database schema and automatically create API endpoints
- 🗄️ Multiple Database Options: Supports SQL Server, MySQL, and PostgreSQL (one at a time)
- 🌐 Multiple API Protocols: REST, gRPC, GraphQL simultaneously
- 📋 Content Negotiation: REST APIs support JSON (Newtonsoft.Json), XML, and YAML
- 🔧 Extensible: Partial classes for custom controllers, services, queries, and mutations
- 📦 Modular: Separate libraries for each provider
- 🎯 Builder Pattern: Fluent API for easy configuration
- 📊 Code Coverage: Generated code automatically excluded from coverage reports
- 🔄 Source Generators: Compile-time code generation support with
Ddap.CodeGen - 🔐 Authentication & Authorization: JWT, role-based access, entity-level security with
Ddap.Auth - 🔔 Real-Time Subscriptions: SignalR and GraphQL subscriptions with
Ddap.Subscriptions - ☁️ .NET Aspire Integration: Seamless integration with
Ddap.Aspirefor cloud-native apps
Quick Start
Installation
Choose the packages you need based on your database and API requirements:
# Core (always required)
dotnet add package Ddap.Core
# Database Providers (choose one):
dotnet add package Ddap.Data.Dapper.SqlServer # SQL Server with Dapper
dotnet add package Ddap.Data.Dapper.MySQL # MySQL with Dapper
dotnet add package Ddap.Data.Dapper.PostgreSQL # PostgreSQL with Dapper
dotnet add package Ddap.Data.EntityFramework # Entity Framework Core (database-agnostic)
# API Providers (choose one or more):
dotnet add package Ddap.Rest # REST API (JSON/XML/YAML)
dotnet add package Ddap.Grpc # gRPC
dotnet add package Ddap.GraphQL # GraphQL
Configuration
Choose your database provider and configure DDAP:
SQL Server with Dapper
using Ddap.Core;
using Ddap.Data.Dapper.SqlServer;
using Ddap.Rest;
using Ddap.Grpc;
using Ddap.GraphQL;
var builder = WebApplication.CreateBuilder(args);
builder.Services
.AddDdap(options =>
{
options.ConnectionString = "Server=localhost;Database=MyDb;...";
})
.AddSqlServerDapper() // SQL Server with Dapper
.AddRest() // Enable REST API (JSON/XML/YAML)
.AddGrpc() // Enable gRPC
.AddGraphQL(); // Enable GraphQL
var app = builder.Build();
app.UseRouting();
app.MapControllers();
app.MapGraphQL("/graphql");
app.Run();
MySQL with Dapper
using Ddap.Data.Dapper.MySQL;
builder.Services
.AddDdap(options =>
{
options.ConnectionString = "Server=localhost;Database=MyDb;User=root;Password=...";
})
.AddMySqlDapper() // MySQL with Dapper
.AddRest()
.AddGraphQL();
PostgreSQL with Dapper
using Ddap.Data.Dapper.PostgreSQL;
builder.Services
.AddDdap(options =>
{
options.ConnectionString = "Host=localhost;Database=MyDb;Username=postgres;Password=...";
})
.AddPostgreSqlDapper() // PostgreSQL with Dapper
.AddRest()
.AddGrpc();
Content Negotiation (REST API)
DDAP REST APIs support multiple output formats using Newtonsoft.Json for JSON serialization:
JSON (Default - Newtonsoft.Json)
curl -H "Accept: application/json" http://localhost:5000/api/entity
XML
curl -H "Accept: application/xml" http://localhost:5000/api/entity
YAML
curl -H "Accept: application/yaml" http://localhost:5000/api/entity
API Examples
REST API
# Get all entities
GET /api/entity
# Get entity metadata
GET /api/entity/{entityName}/metadata
GraphQL
query {
entities {
name
schema
propertyCount
}
}
Extensibility
All controllers, services, queries, and mutations are partial classes:
namespace Ddap.Rest;
public partial class EntityController
{
[HttpGet("custom")]
public IActionResult CustomEndpoint()
{
return Ok("Custom logic here");
}
}
namespace Ddap.GraphQL;
public partial class Query
{
public string CustomQuery() => "Custom GraphQL query";
}
Project Structure
ddap/
├── src/
│ ├── Ddap.Core/ # Core abstractions and interfaces
│ │ └── Internals/ # Internal implementation classes
│ ├── Ddap.Data/ # Legacy data provider (deprecated)
│ ├── Ddap.Data.EntityFramework/ # EF Core provider (database-agnostic)
│ ├── Ddap.Data.Dapper.SqlServer/ # SQL Server with Dapper
│ ├── Ddap.Data.Dapper.MySQL/ # MySQL with Dapper
│ ├── Ddap.Data.Dapper.PostgreSQL/ # PostgreSQL with Dapper
│ ├── Ddap.Memory/ # In-memory entity management
│ ├── Ddap.CodeGen/ # Source generators
│ ├── Ddap.Rest/ # REST API provider (JSON/XML/YAML)
│ ├── Ddap.Grpc/ # gRPC provider
│ └── Ddap.GraphQL/ # GraphQL provider
├── tests/
│ └── Ddap.Tests/ # Unit and integration tests
├── examples/
│ └── Ddap.Example.Api/ # Example application
└── docs/ # Documentation
Database Support
- SQL Server - Full support with indexes, relationships, composite keys
- MySQL - Full support
- PostgreSQL - Full support
All providers support:
- Complex indexes
- Foreign key relationships
- Composite primary keys
- UUID/GUID keys
- Auto-increment columns
Advanced Features
Authentication & Authorization (Ddap.Auth)
Secure your APIs with JWT authentication and role-based authorization:
builder.Services
.AddDdap(options => { /* ... */ })
.AddSqlServerDapper()
.AddAuth(authOptions =>
{
authOptions.RequireAuthenticationByDefault = true;
authOptions.AddEntityPolicy("Users", policy => policy.RequireRole("Admin"));
authOptions.AddEntityPolicy("Products", policy => policy.RequireAuthenticatedUser());
})
.AddRest();
Features:
- JWT Bearer authentication
- Role-based authorization
- Entity-level security policies
- Field-level access control
- Multi-tenant support
Real-Time Subscriptions (Ddap.Subscriptions)
Get real-time notifications when data changes:
builder.Services
.AddDdap(options => { /* ... */ })
.AddSqlServerDapper()
.AddRest()
.AddGraphQL()
.AddSubscriptions(subscriptionOptions =>
{
subscriptionOptions.EnableFor("Products");
subscriptionOptions.NotifyOnCreate = true;
subscriptionOptions.NotifyOnUpdate = true;
});
Features:
- SignalR integration
- GraphQL subscriptions
- WebSocket support
- Filtered notifications
- Custom event handlers
📖 See full Subscriptions example
Source Generator (Ddap.CodeGen)
Generate strongly-typed entity classes at compile-time:
[GenerateEntity("Products")]
public partial class Product
{
// Properties generated from database schema at compile-time
// Full IntelliSense support!
}
Benefits:
- Type-safe property access
- IntelliSense support
- Compile-time checking
- No reflection overhead
- Auto-generated DTOs
.NET Aspire Integration (Ddap.Aspire)
Seamless integration with .NET Aspire for cloud-native applications:
var builder = DistributedApplication.CreateBuilder(args);
var db = builder.AddSqlServer("sqlserver").AddDatabase("catalogdb");
var api = builder.AddDdapApi("ddap-api")
.WithReference(db)
.WithRestApi()
.WithGraphQL()
.WithAutoRefresh(30);
builder.Build().Run();
Features:
- Automatic service discovery
- Database connection management
- Auto-refresh for schema changes
- Observability dashboard
- Easy scaling
Database Support
- SQL Server - Full support with indexes, relationships, composite keys
- MySQL - Full support
- PostgreSQL - Full support
All providers support:
- Complex indexes
- Foreign key relationships
- Composite primary keys
- UUID/GUID keys
- Auto-increment columns
CI/CD
The project includes GitHub Actions workflows for:
- Build & Test: Automated testing with SQL Server, MySQL, PostgreSQL containers
- Release: Manual release creation with automatic versioning
- Documentation: Automatic documentation deployment to GitHub Pages
Contributing
We welcome contributions! Please see our Contributing Guide for details on:
- How to report bugs
- How to suggest enhancements
- Development setup
- Pull request process
- Coding standards
- Testing guidelines
Quick start for contributors:
# Fork and clone the repository
git clone https://github.com/YOUR-USERNAME/ddap.git
cd ddap
# Install dependencies
dotnet restore
# Build the solution
dotnet build
# Run tests
dotnet test
License
This project is licensed under the MIT License - see the LICENSE file for details.
Roadmap
Completed ✅
- ✅ Authentication and authorization support - Available via
Ddap.Authpackage - ✅ Real-time subscriptions - Available via
Ddap.Subscriptionspackage with SignalR - ✅ Source generator support - Available via
Ddap.CodeGenpackage - ✅ .NET Aspire integration - Available via
Ddap.Aspirepackage
In Progress 🚧
- Enhanced query filtering and pagination
- Dynamic .proto file download endpoint for gRPC
- REST endpoints derived from gRPC services
Planned 📋
- OData support
- Webhook notifications
- Rate limiting and throttling
- Advanced caching strategies
- Multi-tenancy support
Documentation
📚 Comprehensive Guides
- Getting Started - Quick start guide and basic setup
- Architecture - Understand DDAP's design and components
- Advanced Usage - Extensibility, custom endpoints, and patterns
- Database Providers - SQL Server, MySQL, PostgreSQL, EF Core
- API Providers - REST, gRPC, and GraphQL documentation
- Troubleshooting - Common issues and solutions
🌐 Online Documentation
Full documentation is available at https://schivei.github.io/ddap
Examples
Comprehensive examples demonstrating each feature:
- Basic API Example - REST, gRPC, and GraphQL with multiple database providers
- Aspire Integration - .NET Aspire orchestration with auto-refresh
- Authentication & Authorization - JWT authentication, role-based access, entity-level security
- Real-Time Subscriptions - SignalR and GraphQL subscriptions for live updates
- Source Generator - Compile-time entity generation with strong typing
Each example includes:
- Complete source code
- Step-by-step setup instructions
- Configuration examples
- Usage demonstrations
- Best practices
Support
For issues, questions, or feature requests, please open an issue on GitHub.
Getting Help
- 📖 Documentation: Check the docs directory
- 💬 Discussions: GitHub Discussions
- 🐛 Bug Reports: GitHub Issues
- 💡 Feature Requests: GitHub Issues with enhancement label
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Ddap.Core (>= 1.0.0)
- Microsoft.EntityFrameworkCore (>= 10.0.2)
- Microsoft.Extensions.Hosting.Abstractions (>= 10.0.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.2.333-preview-333 | 87 | 2/1/2026 |
| 1.0.2.282-preview-282 | 80 | 1/31/2026 |
| 1.0.2.272-preview-272 | 79 | 1/31/2026 |
| 1.0.2.220-preview-220 | 84 | 1/30/2026 |
| 1.0.2.216-preview-216 | 79 | 1/30/2026 |
| 1.0.2.3 | 86 | 2/1/2026 |
| 1.0.2-alpha.2 | 37 | 1/30/2026 |
| 1.0.1 | 90 | 1/30/2026 |
| 1.0.0-preview-20260130-022600 | 79 | 1/30/2026 |
| 1.0.0-preview-20260130-022504 | 72 | 1/30/2026 |
| 1.0.0-preview-20260130-021737 | 73 | 1/30/2026 |
| 1.0.0-preview-20260130-020856 | 76 | 1/30/2026 |
| 1.0.0-preview-20260130-020408 | 78 | 1/30/2026 |
| 1.0.0-preview-20260130-010758 | 79 | 1/30/2026 |
| 1.0.0-preview-20260129-232814 | 79 | 1/29/2026 |
| 1.0.0-preview-20260129-141732 | 82 | 1/29/2026 |
| 1.0.0-preview-20260129-111900 | 76 | 1/29/2026 |
| 1.0.0-preview-20260124-015240 | 78 | 1/24/2026 |