From d295059c1ffd9d7d5b0cf4b7f3434058a89b84cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?SAL=C4=B0H=20=C3=96ZKARA?= Date: Wed, 18 Feb 2026 14:49:24 +0300 Subject: [PATCH] Update fluent-api.md --- docs/en/low-code/fluent-api.md | 40 +++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/docs/en/low-code/fluent-api.md b/docs/en/low-code/fluent-api.md index ab98e6f636..501fc77bac 100644 --- a/docs/en/low-code/fluent-api.md +++ b/docs/en/low-code/fluent-api.md @@ -524,7 +524,45 @@ public static class MyAppLowCodeInitializer } ```` -Then call `await MyAppLowCodeInitializer.InitializeAsync();` in your `Program.cs` before building the application. +Configure your DbContext to implement `IDbContextWithDynamicEntities`: + +````csharp +public class MyAppDbContext : AbpDbContext, IDbContextWithDynamicEntities +{ + // ... constructors and DbSets ... + + protected override void OnModelCreating(ModelBuilder builder) + { + builder.ConfigureDynamicEntities(); + base.OnModelCreating(builder); + } +} +```` + +Configure your DbContextFactory for EF Core CLI commands: + +````csharp +public class MyAppDbContextFactory : IDesignTimeDbContextFactory +{ + public MyAppDbContext CreateDbContext(string[] args) + { + var configuration = BuildConfiguration(); + + MyAppEfCoreEntityExtensionMappings.Configure(); + + // ----- Ensure Low-Code system is initialized before running migrations --- + LowCodeEfCoreTypeBuilderExtensions.Configure(); + AsyncHelper.RunSync(MyAppLowCodeInitializer.InitializeAsync); + // ------------------------------- + + var builder = new DbContextOptionsBuilder() + .UseSqlServer(configuration.GetConnectionString("Default")); + + return new MyAppDbContext(builder.Options); + } + + // ... BuildConfiguration method ... +} This gives you four auto-generated pages (Customers, Products, Orders with nested OrderLines), complete with permissions, menu items, foreign key lookups, and interceptor-based business rules.