Browse Source

Add a safe point to override max lengths for existing properties.

pull/4513/head
Halil İbrahim Kalkan 6 years ago
parent
commit
b273d1944c
  1. 5
      templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Domain.Shared/MyProjectNameDomainSharedModule.cs
  2. 35
      templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Domain.Shared/MyProjectNameModuleExtensionConfigurator.cs
  3. 2
      templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore/EntityFrameworkCore/MyProjectNameEfCoreEntityExtensionMappings.cs

5
templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Domain.Shared/MyProjectNameDomainSharedModule.cs

@ -26,6 +26,11 @@ namespace MyCompanyName.MyProjectName
)] )]
public class MyProjectNameDomainSharedModule : AbpModule public class MyProjectNameDomainSharedModule : AbpModule
{ {
public override void PreConfigureServices(ServiceConfigurationContext context)
{
MyProjectNameModulePropertyConfigurator.Configure();
}
public override void ConfigureServices(ServiceConfigurationContext context) public override void ConfigureServices(ServiceConfigurationContext context)
{ {
Configure<AbpVirtualFileSystemOptions>(options => Configure<AbpVirtualFileSystemOptions>(options =>

35
templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Domain.Shared/MyProjectNameModuleExtensionConfigurator.cs

@ -0,0 +1,35 @@
using System.ComponentModel.DataAnnotations;
using Volo.Abp.Identity;
using Volo.Abp.ObjectExtending;
using Volo.Abp.Threading;
namespace MyCompanyName.MyProjectName
{
public static class MyProjectNameModulePropertyConfigurator
{
private static readonly OneTimeRunner OneTimeRunner = new OneTimeRunner();
public static void Configure()
{
OneTimeRunner.Run(() =>
{
ConfigureExistingProperties();
});
}
private static void ConfigureExistingProperties()
{
/* You can change max lengths for properties of the
* entities defined in the modules used by your application.
*
* Example: Change user and role name max lengths
IdentityUserConsts.MaxNameLength = 99;
IdentityRoleConsts.MaxNameLength = 99;
* Notice: It is not suggested to change property lengths
* unless you really need it. Go with the standard values wherever possible.
*/
}
}
}

2
templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore/EntityFrameworkCore/MyProjectNameEfCoreEntityExtensionMappings.cs

@ -10,6 +10,8 @@ namespace MyCompanyName.MyProjectName.EntityFrameworkCore
public static void Configure() public static void Configure()
{ {
MyProjectNameModulePropertyConfigurator.Configure();
OneTimeRunner.Run(() => OneTimeRunner.Run(() =>
{ {
/* You can configure entity extension properties for the /* You can configure entity extension properties for the

Loading…
Cancel
Save