dotnetcore / dotnetcore/AspectCore-Framework

suggest:创建代理类类型时执行自定义操作。

Open
#238 1 comment 0 reactions 0 assignees View on GitHub
feature todo
Dominant language
C#
Stars
1.8k
Forks
332
PR merge metrics
No merged PRs in 30d

Description

提议,添加一个配置项,以便在创建代理类时可执行一些自定义操作,如:

``` csharp
services.ConfigureDynamicProxy({
c=>c.Interceptors.AddServiced(
m=>m.DeclaringType.Name.EndsWith("AppService"));
c.OnGenerateProxy(context=>context.TypeBuilder.SetCustomAttribute(
CustomAttributeBuildeUtils.DefineCustomAttribute(typeof(DynamicallyAttribute)););

[NonAspect]
public interface IAspectConfiguration
{
AspectValidationHandlerCollection ValidationHandlers { get; }

InterceptorCollection Interceptors { get; }

NonAspectPredicateCollection NonAspectPredicates { get; }

bool ThrowAspectException { get; set; }

IAspectConfiguration OnGenerateProxy(Action configureAction);
}

public sealed class GenerateProxyContext
{

public TypeBuilder TypeBuilder { get; init; }

public Type ServiceType { get; init; }

public Type ImplementType { get; init; }

}

```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.