https://github.com/tinylit/inkslab.expressions
https://github.com/tinylit/inkslab.expressions
Last synced: over 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/tinylit/inkslab.expressions
- Owner: tinylit
- License: mit
- Created: 2023-10-21T11:27:22.000Z (over 2 years ago)
- Default Branch: develop
- Last Pushed: 2023-10-30T12:13:53.000Z (over 2 years ago)
- Last Synced: 2024-04-26T22:42:22.974Z (about 2 years ago)
- Language: C#
- Size: 443 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README




[](../../issues)
### “Inkslab.Expressions”是什么?
Inkslab.Expressions 是一套基于原生Emit指令封装的类型生成器,封装了类似于Expression的表达式语法,简单易用。
### 如何安装?
First, [install NuGet](http://docs.nuget.org/docs/start-here/installing-nuget). Then, install [Inkslab.Expressions](https://www.nuget.org/packages/inkslab.expressions/) from the package manager console:
```
PM> Install-Package Inkslab.Expressions
```
NuGet 包
--------
| Package | NuGet | Downloads | Jane Says Markdown |
| ------- | ----- | --------- | --------- |
| Inkslab.Expressions | [](https://www.nuget.org/packages/Inkslab.Expressions/) |  | Core universal design. |
| Inkslab.Intercept | [](https://www.nuget.org/packages/Inkslab.Intercept/) |  | AOP framework based on method return types. |
### 如何使用?
* 实现“InterceptAttribute”、“InterceptAsyncAttribute”、“ReturnValueInterceptAttribute”或“ReturnValueInterceptAsyncAttribute”拦截器属性。
- `ReturnValueInterceptAsyncAttribute` 支持返回值类型为`Task`和`ValueTask`的方法。
- `ReturnValueInterceptAttribute` 支持返回值类型为 `T`、`Task`和`ValueTask`的方法。
- `InterceptAsyncAttribute` 支持返回值类型为`Task`、`ValueTask`、`Task`和`ValueTask`的方法。
- `InterceptAttribute` 支持返回值类型为 `void` 的方法。
> 注:文档中的 `T` 是排除 `Task`、`ValueTask`、`Task<>`和`ValueTask<>`类型或声明类型之外的类型。
* 在依赖注入的接口或类中方法,标记相对于的属性。
* 使用拦截器“UseIntercept”,会自动检测当前服务集合中 **“ServiceDescriptor”** . *“ServiceType”* 服务类,并自动完成类型代理。
```C#
public class Startup {
public void ConfigureServices(IServiceCollection services) {
// 在此语句之前注入的服务实现,会自动生成拦截类。
services.UseIntercept();
}
}
```