From cf339c62d374a302eea364a40c4c78b74be59313 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Thu, 20 Aug 2020 10:50:05 +0300 Subject: [PATCH] Use new MapEfCoreProperty in the documentation. --- .../Customizing-Application-Modules-Extending-Entities.md | 5 ++++- docs/en/Entity-Framework-Core-Migrations.md | 7 +++++-- docs/en/Entity-Framework-Core.md | 7 +++++-- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/docs/en/Customizing-Application-Modules-Extending-Entities.md b/docs/en/Customizing-Application-Modules-Extending-Entities.md index a7c3f4e7cd..bafcc01da2 100644 --- a/docs/en/Customizing-Application-Modules-Extending-Entities.md +++ b/docs/en/Customizing-Application-Modules-Extending-Entities.md @@ -43,7 +43,10 @@ Assume that you want to add a `SocialSecurityNumber` to the `IdentityUser` entit ObjectExtensionManager.Instance .MapEfCoreProperty( "SocialSecurityNumber", - b => { b.HasMaxLength(32); } + (entityBuilder, propertyBuilder) => + { + propertyBuilder.HasMaxLength(32); + } ); ```` diff --git a/docs/en/Entity-Framework-Core-Migrations.md b/docs/en/Entity-Framework-Core-Migrations.md index d59f9f96c7..425ee29d88 100644 --- a/docs/en/Entity-Framework-Core-Migrations.md +++ b/docs/en/Entity-Framework-Core-Migrations.md @@ -398,7 +398,7 @@ builder.Entity(b => You've configured the custom property for your `DbContext` that is used by your application on the runtime. We also need to configure the `MigrationsDbContext`. -Instead of directly changing the `MigrationsDbContext`, we should use the entity extension system of the ABP Framework. Find the `YourProjectNameEntityExtensions` class in the `.EntityFrameworkCore` project of your solution (`BookStoreEntityExtensions` for this example) and change it as shown below: +Instead of directly changing the `MigrationsDbContext`, we could use the entity extension system of the ABP Framework. Find the `YourProjectNameEfCoreEntityExtensionMappings` class in the `.EntityFrameworkCore` project of your solution (`BookStoreMyProjectNameEfCoreEntityExtensionMappings` for this example) and change it as shown below: ````csharp public static class MyProjectNameEntityExtensions @@ -412,7 +412,10 @@ public static class MyProjectNameEntityExtensions ObjectExtensionManager.Instance .MapEfCoreProperty( "Title", - builder => { builder.HasMaxLength(64); } + (entityBuilder, propertyBuilder) => + { + propertyBuilder.HasMaxLength(128); + } ); }); } diff --git a/docs/en/Entity-Framework-Core.md b/docs/en/Entity-Framework-Core.md index 66f9d3c2f9..98163e7c28 100644 --- a/docs/en/Entity-Framework-Core.md +++ b/docs/en/Entity-Framework-Core.md @@ -325,13 +325,16 @@ This section only explains the EF Core related usage of the `ObjectExtensionMana ObjectExtensionManager.Instance .MapEfCoreProperty( "Title", - builder => { builder.HasMaxLength(64); } + (entityBuilder, propertyBuilder) => + { + propertyBuilder.HasMaxLength(64); + } ); ```` If the related module has implemented this feature (by using the `ConfigureEfCoreEntity` explained below), then the new property is added to the model. Then you need to run the standard `Add-Migration` and `Update-Database` commands to update your database to add the new field. ->`MapEfCoreProperty` method must be called before using the related `DbContext`. It is a static method. The best way is to use it in your application as earlier as possible. The application startup template has a `YourProjectNameEntityExtensions` class that is safe to use this method inside. +>`MapEfCoreProperty` method must be called before using the related `DbContext`. It is a static method. The best way is to use it in your application as earlier as possible. The application startup template has a `YourProjectNameEfCoreEntityExtensionMappings` class that is safe to use this method inside. ### ConfigureEfCoreEntity