Ddap.Data.EntityFramework 1.0.0

There is a newer version of this package available.
See the version list below for details.
The owner has unlisted this package. This could mean that the package is deprecated, has security vulnerabilities or shouldn't be used anymore.
dotnet add package Ddap.Data.EntityFramework --version 1.0.0
                    
NuGet\Install-Package Ddap.Data.EntityFramework -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Ddap.Data.EntityFramework" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Ddap.Data.EntityFramework" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Ddap.Data.EntityFramework" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Ddap.Data.EntityFramework --version 1.0.0
                    
#r "nuget: Ddap.Data.EntityFramework, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Ddap.Data.EntityFramework@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Ddap.Data.EntityFramework&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Ddap.Data.EntityFramework&version=1.0.0
                    
Install as a Cake Tool

DDAP - Dynamic Data API Provider

Build and Test NuGet License

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.Aspire for 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

📖 See full Auth example

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

📖 See full CodeGen example

.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

📖 See full Aspire example

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.Auth package
  • Real-time subscriptions - Available via Ddap.Subscriptions package with SignalR
  • Source generator support - Available via Ddap.CodeGen package
  • .NET Aspire integration - Available via Ddap.Aspire package

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

🌐 Online Documentation

Full documentation is available at https://schivei.github.io/ddap

Examples

Comprehensive examples demonstrating each feature:

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

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.