Skip to content
This repository was archived by the owner on Feb 15, 2023. It is now read-only.

Commit

Permalink
Merge pull request #114 from jbogard/mediatr-10
Browse files Browse the repository at this point in the history
Updating to MediatR 10
  • Loading branch information
jbogard authored Jan 6, 2022
2 parents 8d6476c + 5a42687 commit 41037df
Show file tree
Hide file tree
Showing 37 changed files with 1,515 additions and 1,377 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,19 @@ on:
jobs:
build:
strategy:
matrix:
os: [windows-latest]
fail-fast: false
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup dotnet 6.0
uses: actions/setup-dotnet@v1
with:
dotnet-version: '6.0.x'
- name: Build and Test
run: ./Build.ps1
shell: pwsh
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,19 @@ on:
jobs:
build:
strategy:
matrix:
os: [windows-latest]
fail-fast: false
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup dotnet 6.0
uses: actions/setup-dotnet@v1
with:
dotnet-version: '6.0.x'
- name: Build and Test
run: ./Build.ps1
shell: pwsh
Expand Down
3 changes: 2 additions & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<Project>
<PropertyGroup>
<Authors>Jimmy Bogard</Authors>
<LangVersion>latest</LangVersion>
<LangVersion>10.0</LangVersion>
<Nullable>enable</Nullable>
<NoWarn>$(NoWarn);1701;1702;1591</NoWarn>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
<PropertyGroup>
<Description>MediatR extensions for ASP.NET Core</Description>
<Copyright>Copyright Jimmy Bogard</Copyright>
<TargetFrameworks>netstandard2.0</TargetFrameworks>
<TargetFrameworks>netstandard2.1</TargetFrameworks>
<AssemblyName>MediatR.Extensions.Microsoft.DependencyInjection</AssemblyName>
<RootNamespace>MediatR</RootNamespace>
<PackageId>MediatR.Extensions.Microsoft.DependencyInjection</PackageId>
<PackageTags>mediator;request;response;queries;commands;notifications</PackageTags>
<SignAssembly>true</SignAssembly>
Expand All @@ -25,10 +26,10 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="2.0.0" />
<PackageReference Include="MediatR" Version="9.0.0" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" />
<PackageReference Include="MinVer" Version="2.3.1" PrivateAssets="All" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="6.0.0" />
<PackageReference Include="MediatR" Version="10.0.0" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
<PackageReference Include="MinVer" Version="2.5.0" PrivateAssets="All" />
</ItemGroup>

</Project>
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;
}
}
Loading

0 comments on commit 41037df

Please sign in to comment.