ABP provides a powerful interception system that allows you to execute custom logic before and after method calls without modifying the original method code. This is achieved through **dynamic proxying** and is extensively used throughout the ABP framework to implement cross-cutting concerns. ABP's interception is implemented on top of the Castle DynamicProxy library.
ABP provides a powerful interception system that allows you to execute custom logic before and after method calls without modifying the original method code. This is achieved through **dynamic proxying** and is extensively used throughout the ABP framework to implement cross-cutting concerns. ABP's interception is implemented on top of the [Castle DynamicProxy](https://www.castleproject.org/projects/dynamicproxy/) library.
## What is Dynamic Proxying / Interception?
@ -34,23 +34,23 @@ If you are familiar with ASP.NET Core MVC, you've likely used **action filters**
ABP Framework extensively leverages interception to provide built-in features without requiring boilerplate code. Here are some key examples:
### Unit of Work (UOW)
### [Unit of Work (UOW)](../architecture/domain-driven-design/unit-of-work.md)
Automatically begins and commits/rolls back a database transaction when entering or exiting an application service method. This ensures data consistency without manual transaction management.
Input DTOs are automatically validated against data annotation attributes and custom validation rules before executing the service logic, providing consistent validation behavior across all services.
Checks if a feature is enabled before executing the service logic, allowing you to conditionally enable or restrict functionality for tenants or the application.
### Auditing
### [Auditing](./audit-logging.md)
Automatically logs who performed an action, when it happened, what parameters were used, and what data was involved, providing comprehensive audit trails.
@ -101,6 +101,13 @@ The `ShouldIntercept` method is used to determine if the interceptor should be r
> `DynamicProxyIgnoreTypes` is static class that contains the types that should be ignored by the interceptor. See [Performance Considerations](#performance-considerations) for more information.
````csharp
// Define an interface to mark the classes that should be intercepted
public interface IExecutionTimeLogEnabled
{
}
````
````csharp
using System;
using Volo.Abp.DependencyInjection;
@ -112,7 +119,7 @@ public static class ExecutionTimeLogInterceptorRegistrar