Browse Source

Rollback temp code

pull/6551/head
Halil İbrahim Kalkan 6 years ago
parent
commit
9a9c744702
  1. 3
      templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Domain.Shared/Localization/MyProjectName/en.json
  2. 67
      templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Domain.Shared/MyProjectNameModuleExtensionConfigurator.cs

3
templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Domain.Shared/Localization/MyProjectName/en.json

@ -3,7 +3,6 @@
"texts": { "texts": {
"Menu:Home": "Home", "Menu:Home": "Home",
"Welcome": "Welcome", "Welcome": "Welcome",
"LongWelcomeMessage": "Welcome to the application. This is a startup project based on the ABP framework. For more information, visit abp.io.", "LongWelcomeMessage": "Welcome to the application. This is a startup project based on the ABP framework. For more information, visit abp.io."
"SocialSecurityNumber": "Social security no"
} }
} }

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

@ -1,6 +1,5 @@
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using Volo.Abp.Identity; using Volo.Abp.Identity;
using Volo.Abp.Localization;
using Volo.Abp.ObjectExtending; using Volo.Abp.ObjectExtending;
using Volo.Abp.Threading; using Volo.Abp.Threading;
@ -36,46 +35,38 @@ namespace MyCompanyName.MyProjectName
*/ */
} }
public static void ConfigureExtraProperties() private static void ConfigureExtraProperties()
{ {
OneTimeRunner.Run(() => /* You can configure extra properties for the
{ * entities defined in the modules used by your application.
ObjectExtensionManager.Instance.Modules() *
.ConfigureIdentity(identity => * This class can be used to define these extra properties
{ * with a high level, easy to use API.
identity.ConfigureUser(user => *
{ * Example: Add a new property to the user entity of the identity module
user.AddOrUpdateProperty<string>( //property type: string
"SocialSecurityNumber", //property name
property =>
{
//validation rules
property.Attributes.Add(new RequiredAttribute());
property.Attributes.Add(
new StringLengthAttribute(64) {
MinimumLength = 4
}
);
property.UI.OnTable.IsVisible = false; ObjectExtensionManager.Instance.Modules()
.ConfigureIdentity(identity =>
{
identity.ConfigureUser(user =>
{
user.AddOrUpdateProperty<string>( //property type: string
"SocialSecurityNumber", //property name
property =>
{
//validation rules
property.Attributes.Add(new RequiredAttribute());
property.Attributes.Add(new StringLengthAttribute(64) {MinimumLength = 4});
property.Validators.Add(context => //...other configurations for this property
{ }
if (((string) context.Value).StartsWith("B")) );
{ });
context.ValidationErrors.Add( });
new ValidationResult(
"Social security number can not start with the letter 'B', sorry!", * See the documentation for more:
new[] {"extraProperties.SocialSecurityNumber"} * https://docs.abp.io/en/latest/Module-Entity-Extensions
) */
);
}
});
}
);
});
});
});
} }
} }
} }

Loading…
Cancel
Save