Muslim.ConfigureTable 10.0.1

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

Muslim.ConfigureTable

EF Core 10 table setup for entities built on Muslim.EntityAndDto. Every table gets the same defaults — table name, creation date, soft delete — and each entity keeps its own configuration next to it.

dotnet add package Muslim.ConfigureTable

Quick start

Put a nested Configuration class inside the entity and derive it from ConfigureTable<T>:

using Microsoft.EntityFrameworkCore;
using Muslim.ConfigureTable;
using Muslim.EntityAndDto.Entitys;

public class Product : Entity
{
    public string Name { get; set; } = "";
    public decimal Price { get; set; }

    private class Configuration : ConfigureTable<Product>
    {
        protected override void ConfigureCustomizations()
        {
            Builder!.Property(x => x.Name).HasMaxLength(200).IsRequired();
            Builder.Property(x => x.Price).HasPrecision(18, 2);
        }
    }
}

Then load every configuration in the assembly with one line in your DbContext:

public class ShopContext(DbContextOptions<ShopContext> options) : DbContext(options)
{
    public DbSet<Product> Products => Set<Product>();

    protected override void OnModelCreating(ModelBuilder modelBuilder)
    {
        DatabaseInitializer.CreateMigration(modelBuilder, typeof(Product).Assembly, nameof(ShopContext));
    }
}

Register the context as usual and create migrations with the normal EF Core tools:

builder.Services.AddDbContext<ShopContext>(o => o.UseSqlServer(connectionString));
dotnet ef migrations add Initial

What every table gets

Default Result
Table name the class name — Product
CreatedDate filled by the database with GETUTCDATE()
Id indexed
IsDeleted required, defaults to false
Query filter !IsDeleted — deleted rows are hidden from every query

To include deleted rows in one query, use EF Core's IgnoreQueryFilters():

var all = await db.Products.IgnoreQueryFilters().ToListAsync();

Anything you set in ConfigureCustomizations() runs after the defaults, so you can change any of them:

protected override void ConfigureCustomizations()
{
    Builder!.ToTable("Products", "shop");
    Builder.HasIndex(x => x.Name).IsUnique();
}

One assembly, several contexts

By default a configuration is applied to every context that loads the assembly. To limit it, add [Context] with the context names:

public class AuditLog : Entity
{
    public string Action { get; set; } = "";

    [Context(nameof(LogContext))]
    private class Configuration : ConfigureTable<AuditLog> { }
}

AuditLog is now mapped in LogContext only. Names are case-sensitive. [Context] with no names excludes the configuration from every context.

Good to know

  • GETUTCDATE() is SQL Server. On another database, set the default yourself: Builder!.Property(x => x.CreatedDate).HasDefaultValueSql("CURRENT_TIMESTAMP");
  • Calling HasQueryFilter in your configuration replaces the soft-delete filter. Keep !x.IsDeleted in your own filter if you still need it.
  • Only concrete classes that inherit Entity and have a nested class named Configuration are picked up. The class can be private, and needs a parameterless constructor.
  • CreateMigration builds the EF Core model. It does not create migrations or the database.
  • Configurations are found by reflection, so this package is not suitable for trimming or Native AOT.
Package Use it for
Muslim.EntityAndDto Base entity and DTO classes

Coding-agent guidance

When you build a project that uses this package, a short guide for AI coding agents is copied to .agents/skills/muslim-configuretable/ at the root of your repository. Agents that read skills from .agents/skills, such as Codex and GitHub Copilot in VS Code, use it to write correct code against this package. Your own files and other skills are never touched, and nothing is deleted automatically.

To turn it off, add this to your project or Directory.Build.props:

<PropertyGroup>
  <MuslimConfigureTableGenerateSkill>false</MuslimConfigureTableGenerateSkill>
</PropertyGroup>

License

See LICENSE.txt.

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.

Version Downloads Last Updated
10.0.1 40 10/15/2026
8.0.1 100 10/4/2026
8.0.0 105 9/23/2026
5.0.1 120 8/10/2026
5.0.0 217 1/23/2025
4.0.0 209 1/4/2025
3.0.0 206 10/5/2024