Interpose
所属分类:Windows编程
开发工具:C#
文件大小:0KB
下载次数:0
上传日期:2022-09-30 14:06:26
上 传 者:
sh-1993
说明: Interpose.Core是一个对.NET代码进行动态拦截的框架(面向方面编程)。插入.Core目标.NET Stan...,
(Interpose.Core is a framework for doing dynamic interception of .NET code (Aspect-Oriented Programming). Interpose.Core targets .NET Standard 2.0.)
文件列表:
Interpose.Core.Handlers/ (0, 2022-09-30)
Interpose.Core.Handlers/AccessControlInterceptionAttribute.cs (799, 2022-09-30)
Interpose.Core.Handlers/AccessControlInterceptionHandler.cs (943, 2022-09-30)
Interpose.Core.Handlers/AsyncInterceptionAttribute.cs (429, 2022-09-30)
Interpose.Core.Handlers/AsyncInterceptionHandler.cs (601, 2022-09-30)
Interpose.Core.Handlers/CachingInterceptionAttribute.cs (903, 2022-09-30)
Interpose.Core.Handlers/CachingInterceptionHandler.cs (2144, 2022-09-30)
Interpose.Core.Handlers/CallbackInterceptionAttribute.cs (935, 2022-09-30)
Interpose.Core.Handlers/CallbackInterceptionHandler.cs (2544, 2022-09-30)
Interpose.Core.Handlers/InstanceInterceptorExtensions.cs (2540, 2022-09-30)
Interpose.Core.Handlers/Interpose.Core.Handlers.csproj (1534, 2022-09-30)
Interpose.Core.Handlers/LoggingInterceptionAttribute.cs (986, 2022-09-30)
Interpose.Core.Handlers/LoggingInterceptionHandler.cs (1494, 2022-09-30)
Interpose.Core.Handlers/NotifyPropertyChangeAttribute.cs (412, 2022-09-30)
Interpose.Core.Handlers/NotifyPropertyChangeHandler.cs (2119, 2022-09-30)
Interpose.Core.Handlers/RetriesInterceptionAttribute.cs (874, 2022-09-30)
Interpose.Core.Handlers/RetriesInterceptionHandler.cs (1049, 2022-09-30)
Interpose.Core.Handlers/ServiceCollectionExtensions.cs (850, 2022-09-30)
Interpose.Core.Handlers/TimeoutInterceptionAttribute.cs (746, 2022-09-30)
Interpose.Core.Handlers/TimeoutInterceptionHandler.cs (880, 2022-09-30)
Interpose.Core.Handlers/TransactionInterceptionAttribute.cs (1386, 2022-09-30)
Interpose.Core.Handlers/TransactionInterceptionHandler.cs (1330, 2022-09-30)
Interpose.Core.Handlers/ValidationInterceptionAttribute.cs (639, 2022-09-30)
Interpose.Core.Handlers/ValidationInterceptionHandler.cs (1039, 2022-09-30)
Interpose.Core.Tests/ (0, 2022-09-30)
Interpose.Core.Tests/Calculator.cs (273, 2022-09-30)
Interpose.Core.Tests/ConsoleInterceptionHandler.cs (341, 2022-09-30)
Interpose.Core.Tests/ConsoleLogInterceptionAttribute.cs (258, 2022-09-30)
Interpose.Core.Tests/ErrorOperation.cs (281, 2022-09-30)
Interpose.Core.Tests/ICalculator.cs (189, 2022-09-30)
Interpose.Core.Tests/IErrorOperation.cs (114, 2022-09-30)
Interpose.Core.Tests/ILongWait.cs (118, 2022-09-30)
Interpose.Core.Tests/IMyType.cs (132, 2022-09-30)
Interpose.Core.Tests/INotifiable.cs (204, 2022-09-30)
Interpose.Core.Tests/IProtectedClass.cs (118, 2022-09-30)
Interpose.Core.Tests/IValidatable.cs (519, 2022-09-30)
Interpose.Core.Tests/InterceptionTests.cs (11299, 2022-09-30)
Interpose.Core.Tests/Interpose.Core.Tests.csproj (1125, 2022-09-30)
Interpose.Core.Tests/LongWait.cs (219, 2022-09-30)
... ...
# Interpose.Core
## Introduction
Interpose.Core is a framework for doing dynamic interception of .NET code (Aspect-Oriented Programming).
Interpose.Core targets .NET Standard 2.0.
## Concepts
Interception mechanisms all fall into one kind:
* Type interception: a new type is generated on the fly; examples are virtual method interception
* Instance interception: uses any existing instance; examples are interface and dynamic
Interpose.Core supports the following interception mechanisms:
* Virtual method (type): only virtual methods of non-sealed classes can be intercepted
* Interface (instance): any method declared in an interface can be intercepted
* Dynamic (instance): any method or property can be implemented as long as the object can be treated as dynamic
* DispatchProxy (instance): any method declared in an interface can be intercepted
You can use one of the following generators:
* CodeDOM generator
* Roslyn generator
As for the actual handlers, we have:
* Custom handler, a type that implements IInterceptionHandler
* Attributes-base handler
* Registry-based handler, where you register an handler for a specific method
* Event-based handler
* Delegate-based handler
## Usage
Instance interception (interface):
var interceptor = new InterfaceInterceptor();
var instance = new MyType();
var handler = new MyHandler();
var proxy = interceptor.Intercept(instance, typeof(IMyType), handler) as IMyType;
Type interception (virtual method):
var interceptor = new VirtualMethodInterceptor();
var proxyType = interceptor.Intercept(typeof(MyType), typeof(MyHandler));
## Installation
You can either:
- Clone from GitHub: [http://github.com/rjperes/Interpose.Core](http://github.com/rjperes/Interpose.Core)
- Install via Nuget: [https://www.nuget.org/packages/Interpose.Core](https://www.nuget.org/packages/Interpose.Core).
## Contacts
If you see any value in this and wish to send me your comments, please do so through [GitHub](https://github.com/rjperes/Interpose.Core). Questions and suggestions are welcome too!
## Licenses
This software is distributed under the terms of the Free Software Foundation Lesser GNU Public License (LGPL), version 2.1 (see lgpl.txt).
## Copyright
You are free to use this as you wish, but I ask you to please send me a note about it.
近期下载者:
相关文件:
收藏者: