Checklist
1
Create the entity class in Domain
BaseEntity— providesId(Guid)ITenantScopedEntity— requiresTenantIdproperty; enables global query filterIAuditableEntity— requiresCreatedAtandUpdatedAt; automatically set bySaveChangesAsync
IUserScopedEntity instead and filter by UserId.2
Create the EF Core configuration
3
Register the configuration in ApplicationDbContext
4
Add to IApplicationDbContext interface
5
Create and apply the migration
Common mistakes
Forgetting the global query filter — if you omitHasQueryFilter, queries return records from all tenants. No error occurs; data leaks silently. Always add the filter for tenant-scoped entities.
Forgetting to register the configuration — if you create TagConfiguration but do not call ApplyConfiguration in OnModelCreating, the entity uses EF Core’s conventions and has no filter, no unique index, and no cascade delete.
Creating the migration before adding DbSet — EF Core discovers entities through DbSet properties. If DbSet<Tag> is missing, the migration will not include the table. Add the DbSet first.
Using int for primary keys — AspFox uses Guid PKs throughout. Using int breaks the BaseEntity contract and makes the admin panel and audit log behave unexpectedly.