This repository was archived by the owner on Feb 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #114 from jbogard/mediatr-10
Updating to MediatR 10
- Loading branch information
Showing
37 changed files
with
1,515 additions
and
1,377 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
85 changes: 39 additions & 46 deletions
85
src/MediatR.Extensions.Microsoft.DependencyInjection/MediatrServiceConfiguration.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,49 @@ | ||
using Microsoft.Extensions.DependencyInjection; | ||
|
||
namespace MediatR | ||
namespace MediatR; | ||
|
||
using System; | ||
|
||
public class MediatRServiceConfiguration | ||
{ | ||
using System; | ||
public Func<Type, bool> TypeEvaluator { get; private set; } = t => true; | ||
public Type MediatorImplementationType { get; private set; } | ||
public ServiceLifetime Lifetime { get; private set; } | ||
public RequestExceptionActionProcessorStrategy RequestExceptionActionProcessorStrategy { get; set; } | ||
|
||
public MediatRServiceConfiguration() | ||
{ | ||
MediatorImplementationType = typeof(Mediator); | ||
Lifetime = ServiceLifetime.Transient; | ||
} | ||
|
||
public MediatRServiceConfiguration Using<TMediator>() where TMediator : IMediator | ||
{ | ||
MediatorImplementationType = typeof(TMediator); | ||
return this; | ||
} | ||
|
||
public MediatRServiceConfiguration AsSingleton() | ||
{ | ||
Lifetime = ServiceLifetime.Singleton; | ||
return this; | ||
} | ||
|
||
public MediatRServiceConfiguration AsScoped() | ||
{ | ||
Lifetime = ServiceLifetime.Scoped; | ||
return this; | ||
} | ||
|
||
public enum RequestExceptionActionProcessorStrategy | ||
public MediatRServiceConfiguration AsTransient() | ||
{ | ||
ApplyForUnhandledExceptions, | ||
ApplyForAllExceptions | ||
Lifetime = ServiceLifetime.Transient; | ||
return this; | ||
} | ||
|
||
public class MediatRServiceConfiguration | ||
public MediatRServiceConfiguration WithEvaluator(Func<Type, bool> evaluator) | ||
{ | ||
public Func<Type, bool> TypeEvaluator { get; private set; } = t => true; | ||
public Type MediatorImplementationType { get; private set; } | ||
public ServiceLifetime Lifetime { get; private set; } | ||
public RequestExceptionActionProcessorStrategy RequestExceptionActionProcessorStrategy { get; set; } | ||
|
||
public MediatRServiceConfiguration() | ||
{ | ||
MediatorImplementationType = typeof(Mediator); | ||
Lifetime = ServiceLifetime.Transient; | ||
} | ||
|
||
public MediatRServiceConfiguration Using<TMediator>() where TMediator : IMediator | ||
{ | ||
MediatorImplementationType = typeof(TMediator); | ||
return this; | ||
} | ||
|
||
public MediatRServiceConfiguration AsSingleton() | ||
{ | ||
Lifetime = ServiceLifetime.Singleton; | ||
return this; | ||
} | ||
|
||
public MediatRServiceConfiguration AsScoped() | ||
{ | ||
Lifetime = ServiceLifetime.Scoped; | ||
return this; | ||
} | ||
|
||
public MediatRServiceConfiguration AsTransient() | ||
{ | ||
Lifetime = ServiceLifetime.Transient; | ||
return this; | ||
} | ||
|
||
public MediatRServiceConfiguration WithEvaluator(Func<Type, bool> evaluator) | ||
{ | ||
TypeEvaluator = evaluator; | ||
return this; | ||
} | ||
TypeEvaluator = evaluator; | ||
return this; | ||
} | ||
} |
Oops, something went wrong.