DBAdminPanel 0.0.3-alpha

This is a prerelease version of DBAdminPanel.
dotnet add package DBAdminPanel --version 0.0.3-alpha
                    
NuGet\Install-Package DBAdminPanel -Version 0.0.3-alpha
                    
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="DBAdminPanel" Version="0.0.3-alpha" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="DBAdminPanel" Version="0.0.3-alpha" />
                    
Directory.Packages.props
<PackageReference Include="DBAdminPanel" />
                    
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 DBAdminPanel --version 0.0.3-alpha
                    
#r "nuget: DBAdminPanel, 0.0.3-alpha"
                    
#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 DBAdminPanel@0.0.3-alpha
                    
#: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=DBAdminPanel&version=0.0.3-alpha&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=DBAdminPanel&version=0.0.3-alpha&prerelease
                    
Install as a Cake Tool

DBAdminPanel

<div align="center"> <img src="logo.svg" alt="DBAdminPanel Logo" width="128" height="128">

A .NET source generator that automatically creates a complete MVC admin panel for Entity Framework Core models. </div>

πŸš€ Features

  • ✨ Automatic CRUD Generation: Generates full Create, Read, Update, Delete operations for all entities
  • 🎨 Modern Angular UI: Beautiful, responsive admin panel built with Angular 19 and Material Design
  • πŸ” Smart Entity Detection: Automatically scans your DbContext and generates controllers for all entities
  • πŸ“Š Dashboard: Central dashboard to access all entity management pages
  • πŸ”— RESTful API: Full REST API endpoints for all CRUD operations
  • πŸ“ Metadata API: Automatic metadata generation for entity properties, relationships, and validation
  • πŸ—ΊοΈ Entity Relationship Diagrams: Visual representation of your database schema using Mermaid
  • ⚑ Source Generator: Zero runtime overhead - all code generated at compile time
  • 🎯 Type-Safe: Fully typed with IntelliSense support
  • πŸ”’ Extensible: Easy to customize and extend

πŸ“¦ Installation

Install the package via NuGet Package Manager:

dotnet add package DBAdminPanel

Or via Package Manager Console:

Install-Package DBAdminPanel

Or add directly to your .csproj:

<ItemGroup>
  <PackageReference Include="DBAdminPanel" Version="1.0.0" />
</ItemGroup>

🎯 Quick Start

1. Add the Package

Add the DBAdminPanel NuGet package to your ASP.NET Core project that contains your DbContext.

2. Configure Services

In your Program.cs, add the DBAdminPanel services:

using DBAdminPanel;
using Microsoft.EntityFrameworkCore;

var builder = WebApplication.CreateBuilder(args);

// Add your DbContext
builder.Services.AddDbContext<YourDbContext>(options =>
    options.UseSqlServer(builder.Configuration.GetConnectionString("DefaultConnection")));

// Add DBAdminPanel
builder.Services.AddDBAdminPanel();

var app = builder.Build();

// Configure the HTTP request pipeline
app.UseRouting();
app.UseAuthorization();

// Use DBAdminPanel (maps routes and static files)
app.UseDBAdminPanel();

app.MapControllers();
app.Run();

3. Mark Your DbContext

The source generator automatically detects DbContext classes. No additional attributes needed! Just ensure your DbContext is accessible:

public class BlogDbContext : DbContext
{
    public BlogDbContext(DbContextOptions<BlogDbContext> options) : base(options) { }
    
    public DbSet<BlogPost> BlogPosts { get; set; }
    public DbSet<Category> Categories { get; set; }
}

4. Access the Admin Panel

Once configured, navigate to /DBAdminPanel to access the dashboard, which lists all entities in your DbContext.

πŸ“š Usage

Entity Management

Individual entity management pages are available at:

  • /DBAdminPanel - Dashboard with all entities
  • /DBAdminPanel/{EntityName} - List all entities (with pagination, sorting, filtering)
  • /DBAdminPanel/{EntityName}/Create - Create new entity
  • /DBAdminPanel/{EntityName}/Edit/{id} - Edit entity
  • /DBAdminPanel/{EntityName}/Details/{id} - View entity details
  • /DBAdminPanel/{EntityName}/Delete/{id} - Delete entity

API Endpoints

The source generator also creates REST API endpoints:

  • GET /api/DBAdminPanel/{EntityName} - Get all entities (with pagination)
  • GET /api/DBAdminPanel/{EntityName}/{id} - Get entity by ID
  • POST /api/DBAdminPanel/{EntityName} - Create entity
  • PUT /api/DBAdminPanel/{EntityName}/{id} - Update entity
  • DELETE /api/DBAdminPanel/{EntityName}/{id} - Delete entity
  • GET /api/DBAdminPanel/{EntityName}/metadata - Get entity metadata

Metadata API

Get detailed metadata about your entities:

GET /api/DBAdminPanel/{EntityName}/metadata

Returns information about:

  • Property types and names
  • Required fields
  • Navigation properties
  • Foreign key relationships
  • Display names and descriptions

Entity Relationship Diagrams

View visual diagrams of your database schema:

GET /DBAdminPanel/diagram/{EntityName}

Diagrams are generated using Mermaid and show:

  • Entity relationships
  • Foreign key connections
  • Property types

πŸ—οΈ How It Works

The source generator:

  1. Scans your project for classes that inherit from DbContext
  2. Identifies all DbSet<T> properties
  3. Analyzes entity properties, relationships, and keys
  4. Generates MVC controllers for each entity with full CRUD operations
  5. Creates API endpoints for programmatic access
  6. Builds metadata classes for UI generation
  7. Provides service registration extensions

All generated code is placed in the DBAdminPanel.Generated namespace and is available at compile time.

πŸ”§ Configuration

Custom Route Prefix

By default, all routes are prefixed with /DBAdminPanel. You can customize this in your Program.cs:

app.UseDBAdminPanel(); // Uses default /DBAdminPanel prefix

Multiple DbContext Support

DBAdminPanel automatically detects and generates controllers for all DbContext classes in your project:

// All DbContexts are automatically detected
builder.Services.AddDbContext<BlogDbContext>(...);
builder.Services.AddDbContext<UserDbContext>(...);
builder.Services.AddDbContext<ProductDbContext>(...);

// All entities from all contexts appear in the dashboard
builder.Services.AddDBAdminPanel();

Entity Key Detection

The source generator automatically detects primary keys using:

  1. Properties named Id
  2. Properties named {EntityName}Id
  3. Properties with [Key] attribute
  4. Composite keys (multiple properties with [Key] attribute)

πŸ“‹ Requirements

  • .NET 8.0, .NET 9.0, or .NET 10.0
  • Entity Framework Core 8.0+ (matching your .NET version)
  • ASP.NET Core MVC (included in .NET)
  • Node.js 20.x (only required for building the package, not for using it)

🎨 UI Features

The Angular-based admin panel includes:

  • πŸ“± Responsive Design: Works on desktop, tablet, and mobile devices
  • πŸ” Advanced Filtering: Filter entities by any property
  • πŸ“Š Sorting: Sort by any column
  • πŸ“„ Pagination: Efficient pagination for large datasets
  • ✨ Material Design: Modern UI using Angular Material
  • 🎯 Form Validation: Client-side and server-side validation
  • πŸ”„ Real-time Updates: Instant feedback on operations
  • 🌐 Internationalization Ready: Easy to localize

πŸ§ͺ Sample Application

See the sample application for a complete working example with:

  • Multiple DbContext classes
  • Various entity types
  • PostgreSQL integration
  • .NET Aspire setup

πŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.

🀝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

πŸ“– Documentation

πŸ’¬ Support

If you encounter any issues or have questions:

  1. Check the Issues page
  2. Create a new issue with detailed information
  3. Join our discussions

πŸ™ Acknowledgments


<div align="center"> Made with ❀️ by the DBAdminPanel team

⭐ Star us on GitHub | πŸ“¦ NuGet Package </div>

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  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.

Version Downloads Last Updated
0.0.3-alpha 61 1/8/2026
0.0.2-alpha 57 1/8/2026
0.0.1-alpha 60 1/8/2026