handleClick(0)
这样写会默认触发方法调用。可以把函数包含在箭头函数中。
handleClick(0)
这样写会默认触发方法调用。可以把函数包含在箭头函数中。
Data Store
The system implements the IBackgroundJobStore abstract class by default. You can also use your own method to implement it
Configuration
Use AbpBackgroundJobWorkerOptions to modify the default configuration.
Default Background Job Manager
Default implementation: First in, first out, retry or timeout after failure, the timeout is two days, and the retry time increases by one minute each time, sort by priority first and then by number of times in ascending order
Disable Job Execution
When you want to disable background jobs of your application, use: AbpBackgroundJobOptions
Job Name
The default Job Name is the full class name, which can also be specified using BackgroundJobName
Cancelling Background Jobs
Use ICancellationTokenProvider to exit the background task and it will continue execution when it is restarted. If you don't want to execution you can return directly.
Enable/Disable for Entities & Properties
Sets whether the property is recorded
Enable/Disable for Other Services
You can use the [Audited] and [DisableAuditing] data annotation identify the class, or inherit the IAuditingEnabled interface
AbpAspNetCoreAuditingUrlOptions
Used to set whether to record Url information
AbpAspNetCoreAuditingOptions
AbpAspNetCoreAuditingOptions configures the request format to ignore auditing
Entity History Selectors
specify the entity to record changes for
AlwaysLogSelectors
即使方法未启用审计功能(未标记 [Audited],或不在 AppService 中),只要其所在的类或方法匹配了 AlwaysLogSelectors 中的规则,ABP 也会记录一次审计日志。
Contributors
你可以通过实现某个接口,向框架的特定流程中“插入自定义逻辑”
EntityHistorySelectors
哪些实体的变更行为(增删改)要写入审计日志数据库中的“实体变更记录表”。
IgnoredTypes
用来排除某些类型的参数或返回值不被记录到审计日志中。
DisableLogActionInfo
是否记录每个方法调用的详细信息(Action Info),也就是 AbpAuditLogActions 表中那一条条“方法调用明细”。
AbpAuditingOptions
配置对象
UseAuditing()
使用时需要把 UseAuditing() 加到管道中,在模板项目中已经添加了
Database Provider Support
Entity Framework Core 支持, MongoDB 不支持,Audit Logging
IObjectValidator
在调用 objectValidator.ValidateAsync(input) 时触发验证
Your application code can throw AbpValidationException, but most of the times it is not needed.
可以手动抛出验证异常
IValidationEnabled Interface
如果你想要在 AppService 层或 Domain Service 层实现参数自动验证,不需要每次手动调用 Validator.Validate(),只要你:
参数 DTO 上加好 [Required] 或 FluentValidation;
类实现 IValidationEnabled;
方法定义为 public virtual;
这种方式针对,软件内部调用
Resolving a Service
在自定义验证中注入服务
Data Annotation Attributes
加验证
Some Best Practices
最佳实践
Creating A Localization Resource
与 Default Resource 一起用
Default Resource
注入默认语言,使用时可以不再指定是哪种类型多语言。 与 Creating A Localization Resource 一起使用。
Inherit From Other Resources
继承别的资源文件
Subscribing to the Exceptions
继承 ExceptionSubscriber 可以发送消息。
AbpExceptionHandlingOptions
在模块范围内配置 SendStackTraceToClients 错误消息是否输出堆栈 SendExceptionsDetailsToClients 错误详细信息是否输出。如果这个值 设置为false 上面的 SendStackTraceToClients 设置为 true也没用
Built-In Exceptions
AbpAuthorizationException 没权限 AbpValidationException 输入有误 EntityNotFoundException 没找到Entity
User Friendly Exception
继承了IUserFriendlyException接口的异常内容不会被改变。
Logging
Error 级别的日志会被自动记录。也可以继承IHasLogLevel接口标识记录或者继承IExceptionWithSelfLogging 在异常中手动记录
The main difference is the ICachedServiceProvider is itself registered as scoped, while the ITransientCachedServiceProvider is registered as transient to the dependency injection system.
ICachedServiceProvider 在不同的作用域中返回同一个对象,ITransientCachedServiceProvider 在同一个对象中返回同一个对象
In any case, you can create a service scope block to safely and immediately release services:
如果是应用程序需要指定scope否则资源会一直不释放
IEnumerable<IExternalLogger> instead of IExternalLogger
如果注入的是集合,会把各种注册的类都添加上
The last registered implementation can be different than you expect.
一个接口注册多个类,注入单个时最后一个生效。
use the ExposeServicesAttribute and ExposeKeyedServiceAttribute attributes together
这两个特性可以同时使用不冲突
ExposeKeyedService Attribute
可以通过特性来关联key指定接口
ExposeServices Attribute
限定关联哪个接口
Dependency Attribute
通过特性可以设置注册的生命周期和是否替换之前的依赖
Exposed Services by Convention
满足默认注册的类会通过接口名筛选哪些接口可以使用。如果类的名字包含接口名的会关联上。接口名前面的I会省略
DependencyAttribute
除了继承指定接口可以自动注册,还可以使用此特性实现
AddAssemblyOf
这个扩展方法能自动注册所有满足条件的类
SkipAutoServiceRegistration to true
在模块的构造函数中设置这个值为true,这个模块中的类不会自动注册
Set the Connection String Name
ConnectionStringName attribute 可以手动指定连接
AbpDbConnectionOptions
如果使用特定的名字配置连接字符串,框架会自动加载配置,也可以用代码指定。 如果模块没有找到相关的连接字符串,会默认使用 default 的连接字符串
Configure the Connection Strings
如果没有为模块指定链接字符串,就会使用 Default 的值
Connection Strings
支持不同模块用不同的数据库也可以多个模块用同一个数据库也可以按租户分
Configuration
下面的方法二选一。框架会自动读取配置文件不需要另外编码。也可以用代码手动指定。
Caching Entities
可以缓存 EF 的实体,当数据库中实体被修改时缓存自动失效。
Batch Operations
可以对缓存批量操作。不是标准的接口方法。ABP Redis Cache integration package.支持这些方法
Unit Of Work Level Cache
为了防止数据被缓存后,数据库中数据回滚导致缓存无效。设置 considerUow 为 true 时,只有工作单元提交成功了缓存才有效。