Browse Source

Use CommandInterceptorDescriptor constructor with name

Replace setting CommandName property with the CommandInterceptorDescriptor(string) constructor in examples. Updated docs/en/low-code/fluent-api.md and docs/en/low-code/interceptors.md to pass "Create" and "Delete" as constructor arguments to simplify and clarify interceptor declarations; no functional change to behavior.
pull/24889/head
SALİH ÖZKARA 1 month ago
parent
commit
6deb25972e
  1. 3
      docs/en/low-code/fluent-api.md
  2. 6
      docs/en/low-code/interceptors.md

3
docs/en/low-code/fluent-api.md

@ -369,9 +369,8 @@ AbpDynamicEntityConfig.EntityConfigurations.Configure(
### Adding Interceptors ### Adding Interceptors
````csharp ````csharp
entity.Interceptors.Add(new CommandInterceptorDescriptor entity.Interceptors.Add(new CommandInterceptorDescriptor("Create")
{ {
CommandName = "Create",
Type = InterceptorType.Pre, Type = InterceptorType.Pre,
Javascript = "if(!context.commandArgs.data['Name']) { globalError = 'Name is required!'; }" Javascript = "if(!context.commandArgs.data['Name']) { globalError = 'Name is required!'; }"
}); });

6
docs/en/low-code/interceptors.md

@ -56,16 +56,14 @@ AbpDynamicEntityConfig.EntityConfigurations.Configure(
"MyApp.Organizations.Organization", "MyApp.Organizations.Organization",
entity => entity =>
{ {
entity.Interceptors.Add(new CommandInterceptorDescriptor entity.Interceptors.Add(new CommandInterceptorDescriptor("Create")
{ {
CommandName = "Create",
Type = InterceptorType.Pre, Type = InterceptorType.Pre,
Javascript = "if(!context.commandArgs.data['Name']) { globalError = 'Name is required!'; }" Javascript = "if(!context.commandArgs.data['Name']) { globalError = 'Name is required!'; }"
}); });
entity.Interceptors.Add(new CommandInterceptorDescriptor entity.Interceptors.Add(new CommandInterceptorDescriptor("Delete")
{ {
CommandName = "Delete",
Type = InterceptorType.Post, Type = InterceptorType.Post,
Javascript = "context.log('Deleted: ' + context.commandArgs.entityId);" Javascript = "context.log('Deleted: ' + context.commandArgs.entityId);"
}); });

Loading…
Cancel
Save