Fixed the `OnRegistered` name typo

pull/15644/head
gdlcf88 3 years ago
parent 57ed23d54d
commit 74b49f4d8f

@ -440,16 +440,16 @@ Use `ICachedServiceProvider` (instead of `ITransientCachedServiceProvider`) unle
## Advanced Features
### IServiceCollection.OnRegistred Event
### IServiceCollection.OnRegistered Event
You may want to perform an action for every service registered to the dependency injection. In the `PreConfigureServices` method of your module, register a callback using the `OnRegistred` method as shown below:
You may want to perform an action for every service registered to the dependency injection. In the `PreConfigureServices` method of your module, register a callback using the `OnRegistered` method as shown below:
````csharp
public class AppModule : AbpModule
{
public override void PreConfigureServices(ServiceConfigurationContext context)
{
context.Services.OnRegistred(ctx =>
context.Services.OnRegistered(ctx =>
{
var type = ctx.ImplementationType;
//...
@ -465,7 +465,7 @@ public class AppModule : AbpModule
{
public override void PreConfigureServices(ServiceConfigurationContext context)
{
context.Services.OnRegistred(ctx =>
context.Services.OnRegistered(ctx =>
{
if (ctx.ImplementationType.IsDefined(typeof(MyLogAttribute), true))
{
@ -478,7 +478,7 @@ public class AppModule : AbpModule
This example simply checks if the service class has `MyLogAttribute` attribute and adds `MyLogInterceptor` to the interceptor list if so.
> Notice that `OnRegistred` callback might be called multiple times for the same service class if it exposes more than one service/interface. So, it's safe to use `Interceptors.TryAdd` method instead of `Interceptors.Add` method. See [the documentation](Dynamic-Proxying-Interceptors.md) of dynamic proxying / interceptors.
> Notice that `OnRegistered` callback might be called multiple times for the same service class if it exposes more than one service/interface. So, it's safe to use `Interceptors.TryAdd` method instead of `Interceptors.Add` method. See [the documentation](Dynamic-Proxying-Interceptors.md) of dynamic proxying / interceptors.
## 3rd-Party Providers

@ -270,16 +270,16 @@ using (var scope = _serviceProvider.CreateScope())
## 高级特性
### IServiceCollection.OnRegistred 事件
### IServiceCollection.OnRegistered 事件
你可能想在注册到依赖注入的每个服务上执行一个操作, 在你的模块的 `PreConfigureServices` 方法中, 使用 `OnRegistred` 方法注册一个回调(callback) , 如下所示:
你可能想在注册到依赖注入的每个服务上执行一个操作, 在你的模块的 `PreConfigureServices` 方法中, 使用 `OnRegistered` 方法注册一个回调(callback) , 如下所示:
````csharp
public class AppModule : AbpModule
{
public override void PreConfigureServices(ServiceConfigurationContext context)
{
context.Services.OnRegistred(ctx =>
context.Services.OnRegistered(ctx =>
{
var type = ctx.ImplementationType;
//...
@ -295,7 +295,7 @@ public class AppModule : AbpModule
{
public override void PreConfigureServices(ServiceConfigurationContext context)
{
context.Services.OnRegistred(ctx =>
context.Services.OnRegistered(ctx =>
{
if (ctx.ImplementationType.IsDefined(typeof(MyLogAttribute), true))
{
@ -308,7 +308,7 @@ public class AppModule : AbpModule
这个示例判断一个服务类是否具有 `MyLogAttribute` 特性, 如果有的话就添加一个 `MyLogInterceptor` 到拦截器集合中.
> 注意, 如果服务类公开了多于一个服务或接口, `OnRegistred` 回调(callback)可能被同一服务类多次调用. 因此, 较安全的方法是使用 `Interceptors.TryAdd` 方法而不是 `Interceptors.Add` 方法. 请参阅动态代理(dynamic proxying)/拦截器 [文档](Dynamic-Proxying-Interceptors.md).
> 注意, 如果服务类公开了多于一个服务或接口, `OnRegistered` 回调(callback)可能被同一服务类多次调用. 因此, 较安全的方法是使用 `Interceptors.TryAdd` 方法而不是 `Interceptors.Add` 方法. 请参阅动态代理(dynamic proxying)/拦截器 [文档](Dynamic-Proxying-Interceptors.md).
## 第三方提供程序

@ -39,7 +39,7 @@ public class AbpAspNetCoreMvcUiWidgetsModule : AbpModule
{
var widgetTypes = new List<Type>();
services.OnRegistred(context =>
services.OnRegistered(context =>
{
if (WidgetAttribute.IsWidget(context.ImplementationType))
{

@ -91,7 +91,7 @@ public class AbpAspNetCoreSignalRModule : AbpModule
{
var hubTypes = new List<Type>();
services.OnRegistred(context =>
services.OnRegistered(context =>
{
if (IsHubClass(context) && !IsDisabledForAutoMap(context))
{

@ -24,7 +24,7 @@ public class AbpAuditingModule : AbpModule
{
public override void PreConfigureServices(ServiceConfigurationContext context)
{
context.Services.OnRegistred(AuditingInterceptorRegistrar.RegisterIfNeeded);
context.Services.OnRegistered(AuditingInterceptorRegistrar.RegisterIfNeeded);
}
public override void ConfigureServices(ServiceConfigurationContext context)

@ -22,7 +22,7 @@ public class AbpAuthorizationModule : AbpModule
{
public override void PreConfigureServices(ServiceConfigurationContext context)
{
context.Services.OnRegistred(AuthorizationInterceptorRegistrar.RegisterIfNeeded);
context.Services.OnRegistered(AuthorizationInterceptorRegistrar.RegisterIfNeeded);
AutoAddDefinitionProviders(context.Services);
}
@ -64,7 +64,7 @@ public class AbpAuthorizationModule : AbpModule
{
var definitionProviders = new List<Type>();
services.OnRegistred(context =>
services.OnRegistered(context =>
{
if (typeof(IPermissionDefinitionProvider).IsAssignableFrom(context.ImplementationType))
{

@ -21,7 +21,7 @@ public class AbpBackgroundJobsAbstractionsModule : AbpModule
{
var jobTypes = new List<Type>();
services.OnRegistred(context =>
services.OnRegistered(context =>
{
if (ReflectionHelper.IsAssignableToGenericType(context.ImplementationType, typeof(IBackgroundJob<>)) ||
ReflectionHelper.IsAssignableToGenericType(context.ImplementationType, typeof(IAsyncBackgroundJob<>)))

@ -5,9 +5,9 @@ namespace Microsoft.Extensions.DependencyInjection;
public static class ServiceCollectionRegistrationActionExtensions
{
// OnRegistred
// OnRegistered
public static void OnRegistred(this IServiceCollection services, Action<IOnServiceRegistredContext> registrationAction)
public static void OnRegistered(this IServiceCollection services, Action<IOnServiceRegistredContext> registrationAction)
{
GetOrCreateRegistrationActionList(services).Add(registrationAction);
}

@ -42,7 +42,7 @@ public class AbpDataModule : AbpModule
{
var contributors = new List<Type>();
services.OnRegistred(context =>
services.OnRegistered(context =>
{
if (typeof(IDataSeedContributor).IsAssignableFrom(context.ImplementationType))
{

@ -47,7 +47,7 @@ public class AbpEventBusModule : AbpModule
var localHandlers = new List<Type>();
var distributedHandlers = new List<Type>();
services.OnRegistred(context =>
services.OnRegistered(context =>
{
if (ReflectionHelper.IsAssignableToGenericType(context.ImplementationType, typeof(ILocalEventHandler<>)))
{

@ -22,7 +22,7 @@ public class AbpFeaturesModule : AbpModule
{
public override void PreConfigureServices(ServiceConfigurationContext context)
{
context.Services.OnRegistred(FeatureInterceptorRegistrar.RegisterIfNeeded);
context.Services.OnRegistered(FeatureInterceptorRegistrar.RegisterIfNeeded);
AutoAddDefinitionProviders(context.Services);
}
@ -57,7 +57,7 @@ public class AbpFeaturesModule : AbpModule
{
var definitionProviders = new List<Type>();
services.OnRegistred(context =>
services.OnRegistered(context =>
{
if (typeof(IFeatureDefinitionProvider).IsAssignableFrom(context.ImplementationType))
{

@ -17,7 +17,7 @@ public class AbpGlobalFeaturesModule : AbpModule
{
public override void PreConfigureServices(ServiceConfigurationContext context)
{
context.Services.OnRegistred(GlobalFeatureInterceptorRegistrar.RegisterIfNeeded);
context.Services.OnRegistered(GlobalFeatureInterceptorRegistrar.RegisterIfNeeded);
}
public override void ConfigureServices(ServiceConfigurationContext context)

@ -63,7 +63,7 @@ public class AbpSecurityModule : AbpModule
{
var contributorTypes = new List<Type>();
services.OnRegistred(context =>
services.OnRegistered(context =>
{
if (typeof(IAbpClaimsPrincipalContributor).IsAssignableFrom(context.ImplementationType))
{

@ -36,7 +36,7 @@ public class AbpSettingsModule : AbpModule
{
var definitionProviders = new List<Type>();
services.OnRegistred(context =>
services.OnRegistered(context =>
{
if (typeof(ISettingDefinitionProvider).IsAssignableFrom(context.ImplementationType))
{

@ -23,7 +23,7 @@ public class AbpTextTemplatingCoreModule : AbpModule
var definitionProviders = new List<Type>();
var contentContributors = new List<Type>();
services.OnRegistred(context =>
services.OnRegistered(context =>
{
if (typeof(ITemplateDefinitionProvider).IsAssignableFrom(context.ImplementationType))
{

@ -7,6 +7,6 @@ public class AbpUnitOfWorkModule : AbpModule
{
public override void PreConfigureServices(ServiceConfigurationContext context)
{
context.Services.OnRegistred(UnitOfWorkInterceptorRegistrar.RegisterIfNeeded);
context.Services.OnRegistered(UnitOfWorkInterceptorRegistrar.RegisterIfNeeded);
}
}

@ -16,7 +16,7 @@ public class AbpValidationModule : AbpModule
{
public override void PreConfigureServices(ServiceConfigurationContext context)
{
context.Services.OnRegistred(ValidationInterceptorRegistrar.RegisterIfNeeded);
context.Services.OnRegistered(ValidationInterceptorRegistrar.RegisterIfNeeded);
AutoAddObjectValidationContributors(context.Services);
}
@ -39,7 +39,7 @@ public class AbpValidationModule : AbpModule
{
var contributorTypes = new List<Type>();
services.OnRegistred(context =>
services.OnRegistered(context =>
{
if (typeof(IObjectValidationContributor).IsAssignableFrom(context.ImplementationType))
{

@ -14,7 +14,7 @@ public class AbpAuthorizationTestModule : AbpModule
{
public override void PreConfigureServices(ServiceConfigurationContext context)
{
context.Services.OnRegistred(onServiceRegistredContext =>
context.Services.OnRegistered(onServiceRegistredContext =>
{
if (typeof(IMyAuthorizedService1).IsAssignableFrom(onServiceRegistredContext.ImplementationType) &&
!DynamicProxyIgnoreTypes.Contains(onServiceRegistredContext.ImplementationType))

@ -19,7 +19,7 @@ public abstract class AbpInterceptionTestBase<TStartupModule> : AbpAsyncIntegrat
services.AddTransient<SimpleResultCacheTestInterceptor>();
services.AddTransient<CachedTestObject>();
services.OnRegistred(registration =>
services.OnRegistered(registration =>
{
if (typeof(SimpleInterceptionTargetClass) == registration.ImplementationType)
{

@ -109,7 +109,7 @@ public class ApplicationService_FluentValidation_Tests : AbpIntegratedTest<Appli
{
public override void PreConfigureServices(ServiceConfigurationContext context)
{
context.Services.OnRegistred(onServiceRegistredContext =>
context.Services.OnRegistered(onServiceRegistredContext =>
{
if (typeof(IMyAppService).IsAssignableFrom(onServiceRegistredContext.ImplementationType) &&
!DynamicProxyIgnoreTypes.Contains(onServiceRegistredContext.ImplementationType))

@ -201,7 +201,7 @@ public class ApplicationService_Validation_Tests : AbpIntegratedTest<Application
{
public override void PreConfigureServices(ServiceConfigurationContext context)
{
context.Services.OnRegistred(onServiceRegistredContext =>
context.Services.OnRegistered(onServiceRegistredContext =>
{
if (typeof(IMyAppService).IsAssignableFrom(onServiceRegistredContext.ImplementationType) &&
!DynamicProxyIgnoreTypes.Contains(onServiceRegistredContext.ImplementationType))

Loading…
Cancel
Save