Full Code of ivanpaulovich/FluentMediator for AI

master 6f1c0a53d332 cached
103 files
142.2 KB
37.4k tokens
239 symbols
1 requests
Download .txt
Repository: ivanpaulovich/FluentMediator
Branch: master
Commit: 6f1c0a53d332
Files: 103
Total size: 142.2 KB

Directory structure:
gitextract_qjfzijxk/

├── .all-contributorsrc
├── .editorconfig
├── .gitignore
├── .vscode/
│   ├── launch.json
│   ├── settings.json
│   └── tasks.json
├── FluentMediator.sln
├── LICENSE
├── README.md
├── azure-pipelines-1.yml
├── azure-pipelines.yml
├── changelog.md
├── docs/
│   └── icon.xcf
├── samples/
│   ├── AspNetCore/
│   │   ├── .vscode/
│   │   │   ├── launch.json
│   │   │   └── tasks.json
│   │   ├── Wallet.sln
│   │   ├── src/
│   │   │   ├── Core/
│   │   │   │   ├── Core.csproj
│   │   │   │   ├── Services/
│   │   │   │   │   └── ICustomerRepository.cs
│   │   │   │   ├── UseCases/
│   │   │   │   │   ├── IRegisterUseCase.cs
│   │   │   │   │   ├── Register.cs
│   │   │   │   │   ├── RegisterCommand.cs
│   │   │   │   │   └── RegisterResponse.cs
│   │   │   │   └── Wallet/
│   │   │   │       └── Customer.cs
│   │   │   ├── Infrastructure/
│   │   │   │   ├── InMemory/
│   │   │   │   │   └── CustomerRepository.cs
│   │   │   │   └── Infrastructure.csproj
│   │   │   └── WebApi/
│   │   │       ├── Controllers/
│   │   │       │   └── Register/
│   │   │       │       ├── CustomersController.cs
│   │   │       │       └── RegisterRequest.cs
│   │   │       ├── Program.cs
│   │   │       ├── Startup.cs
│   │   │       ├── WebApi.csproj
│   │   │       ├── appsettings.Development.json
│   │   │       └── appsettings.json
│   │   └── test/
│   │       └── UnitTests/
│   │           ├── UnitTests.csproj
│   │           └── UseCasesTests/
│   │               └── RegisterTests.cs
│   └── SimpleConsoleApp/
│       ├── .vscode/
│       │   ├── launch.json
│       │   ├── settings.json
│       │   └── tasks.json
│       ├── PingPong/
│       │   ├── PingHandler.cs
│       │   ├── PingPong.csproj
│       │   ├── PingRequest.cs
│       │   └── Program.cs
│       └── Samples.sln
├── src/
│   ├── FluentMediator/
│   │   ├── FluentMediator.csproj
│   │   ├── GetService.cs
│   │   ├── IMediator.cs
│   │   ├── IPipelineProvider.cs
│   │   ├── IPipelineProviderBuilder.cs
│   │   ├── Mediator.cs
│   │   ├── MediatorException.cs
│   │   ├── NullRequestException.cs
│   │   ├── PipelineNotFoundEventArgs.cs
│   │   ├── PipelineProvider.cs
│   │   ├── PipelineProviderBuilder.cs
│   │   └── Pipelines/
│   │       ├── CancellablePipelineAsync/
│   │       │   ├── Direct.cs
│   │       │   ├── ICancellableMediator.cs
│   │       │   ├── ICancellablePipelineAsync.cs
│   │       │   ├── ICancellablePipelineAsyncBuilder.cs
│   │       │   ├── ICancellablePipelineProvider.cs
│   │       │   ├── ICancellablePipelineProviderBuilder.cs
│   │       │   ├── IDirect.cs
│   │       │   ├── Pipeline.cs
│   │       │   └── PipelineBuilder.cs
│   │       ├── IMethodCollection.cs
│   │       ├── INamedPipeline.cs
│   │       ├── IPipelineBehavior.cs
│   │       ├── IPipelineCollection.cs
│   │       ├── ITypedPipeline.cs
│   │       ├── Method.cs
│   │       ├── MethodCollection.cs
│   │       ├── Pipeline/
│   │       │   ├── Direct.cs
│   │       │   ├── IDirect.cs
│   │       │   ├── IPipeline.cs
│   │       │   ├── IPipelineBuilder.cs
│   │       │   ├── ISyncMediator.cs
│   │       │   ├── ISyncPipelineProvider.cs
│   │       │   ├── ISyncPipelineProviderBuilder.cs
│   │       │   ├── Pipeline.cs
│   │       │   └── PipelineBuilder.cs
│   │       ├── PipelineAlreadyExistsException.cs
│   │       ├── PipelineAsync/
│   │       │   ├── Direct.cs
│   │       │   ├── IAsyncMediator.cs
│   │       │   ├── IAsyncPipelineProvider.cs
│   │       │   ├── IAsyncPipelineProviderBuilder.cs
│   │       │   ├── IDirect.cs
│   │       │   ├── IPipelineAsync.cs
│   │       │   ├── IPipelineAsyncBuilder.cs
│   │       │   ├── Pipeline.cs
│   │       │   └── PipelineBuilder.cs
│   │       ├── PipelineBehavior.cs
│   │       ├── PipelineCollection.cs
│   │       ├── PipelineNotFoundException.cs
│   │       └── ReturnFunctionIsNullException.cs
│   └── FluentMediator.Microsoft.Extensions.DependencyInjection/
│       ├── FluentMediator.Microsoft.Extensions.DependencyInjection.csproj
│       └── FluentMediatorExtensions.cs
└── test/
    └── UnitTests/
        ├── BuildingMediatorTests.cs
        ├── MyCustomMediator.cs
        ├── PingPong/
        │   ├── IPingHandler.cs
        │   ├── PingHandler.cs
        │   ├── PingRequest.cs
        │   └── PingResponse.cs
        ├── PublishingRequestsTests.cs
        ├── SendingRequestTests.cs
        └── UnitTests.csproj

================================================
FILE CONTENTS
================================================

================================================
FILE: .all-contributorsrc
================================================
{
  "files": [
    "README.md"
  ],
  "imageSize": 100,
  "commit": false,
  "contributors": [
    {
      "login": "ivanpaulovich",
      "name": "Ivan Paulovich",
      "avatar_url": "https://avatars3.githubusercontent.com/u/7133698?v=4",
      "profile": "https://paulovich.net",
      "contributions": [
        "code",
        "design",
        "test"
      ]
    },
    {
      "login": "joacar",
      "name": "Joakim Carselind",
      "avatar_url": "https://avatars1.githubusercontent.com/u/439028?v=4",
      "profile": "http://www.carselind.se",
      "contributions": [
        "review",
        "ideas"
      ]
    },
    {
      "login": "vag1830",
      "name": "Vaggelis Mparmpas",
      "avatar_url": "https://avatars2.githubusercontent.com/u/1694870?v=4",
      "profile": "https://github.com/vag1830",
      "contributions": [
        "test"
      ]
    }
  ],
  "contributorsPerLine": 7,
  "projectName": "FluentMediator",
  "projectOwner": "ivanpaulovich",
  "repoType": "github",
  "repoHost": "https://github.com"
}


================================================
FILE: .editorconfig
================================================
# editorconfig.org

# top-most EditorConfig file
root = true

# Default settings:
# A newline ending every file
# Use 4 spaces as indentation
[*]
insert_final_newline = true
indent_style = space
indent_size = 4
trim_trailing_whitespace = true

[project.json]
indent_size = 2

# C# files
[*.cs]
# New line preferences
csharp_new_line_before_open_brace = all
csharp_new_line_before_else = true
csharp_new_line_before_catch = true
csharp_new_line_before_finally = true
csharp_new_line_before_members_in_object_initializers = true
csharp_new_line_before_members_in_anonymous_types = true
csharp_new_line_between_query_expression_clauses = true

# Indentation preferences
csharp_indent_block_contents = true
csharp_indent_braces = false
csharp_indent_case_contents = true
csharp_indent_case_contents_when_block = true
csharp_indent_switch_labels = true
csharp_indent_labels = one_less_than_current

# Modifier preferences
csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:suggestion

# avoid this. unless absolutely necessary
dotnet_style_qualification_for_field = false:suggestion
dotnet_style_qualification_for_property = false:suggestion
dotnet_style_qualification_for_method = false:suggestion
dotnet_style_qualification_for_event = false:suggestion

# Types: use keywords instead of BCL types, and permit var only when the type is clear
csharp_style_var_for_built_in_types = false:suggestion
csharp_style_var_when_type_is_apparent = false:none
csharp_style_var_elsewhere = false:suggestion
dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
dotnet_style_predefined_type_for_member_access = true:suggestion

# name all constant fields using PascalCase
dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols  = constant_fields
dotnet_naming_rule.constant_fields_should_be_pascal_case.style    = pascal_case_style
dotnet_naming_symbols.constant_fields.applicable_kinds   = field
dotnet_naming_symbols.constant_fields.required_modifiers = const
dotnet_naming_style.pascal_case_style.capitalization = pascal_case

# static fields should have s_ prefix
dotnet_naming_rule.static_fields_should_have_prefix.severity = suggestion
dotnet_naming_rule.static_fields_should_have_prefix.symbols  = static_fields
dotnet_naming_rule.static_fields_should_have_prefix.style    = static_prefix_style
dotnet_naming_symbols.static_fields.applicable_kinds   = field
dotnet_naming_symbols.static_fields.required_modifiers = static
dotnet_naming_symbols.static_fields.applicable_accessibilities = private, internal, private_protected
dotnet_naming_style.static_prefix_style.required_prefix = s_
dotnet_naming_style.static_prefix_style.capitalization = camel_case 

# internal and private fields should be _camelCase
dotnet_naming_rule.camel_case_for_private_internal_fields.severity = suggestion
dotnet_naming_rule.camel_case_for_private_internal_fields.symbols  = private_internal_fields
dotnet_naming_rule.camel_case_for_private_internal_fields.style    = camel_case_underscore_style
dotnet_naming_symbols.private_internal_fields.applicable_kinds = field
dotnet_naming_symbols.private_internal_fields.applicable_accessibilities = private, internal
dotnet_naming_style.camel_case_underscore_style.required_prefix = _
dotnet_naming_style.camel_case_underscore_style.capitalization = camel_case 

# Code style defaults
csharp_using_directive_placement = outside_namespace:suggestion
dotnet_sort_system_directives_first = true
csharp_prefer_braces = true:refactoring
csharp_preserve_single_line_blocks = true:none
csharp_preserve_single_line_statements = false:none
csharp_prefer_static_local_function = true:suggestion
csharp_prefer_simple_using_statement = false:none
csharp_style_prefer_switch_expression = true:suggestion

# Code quality
dotnet_style_readonly_field = true:suggestion
dotnet_code_quality_unused_parameters = non_public:suggestion

# Expression-level preferences
dotnet_style_object_initializer = true:suggestion
dotnet_style_collection_initializer = true:suggestion
dotnet_style_explicit_tuple_names = true:suggestion
dotnet_style_coalesce_expression = true:suggestion
dotnet_style_null_propagation = true:suggestion
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion
dotnet_style_prefer_inferred_tuple_names = true:suggestion
dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
dotnet_style_prefer_auto_properties = true:suggestion
dotnet_style_prefer_conditional_expression_over_assignment = true:refactoring
dotnet_style_prefer_conditional_expression_over_return = true:refactoring
csharp_prefer_simple_default_expression = true:suggestion

# Expression-bodied members
csharp_style_expression_bodied_methods = true:refactoring
csharp_style_expression_bodied_constructors = true:refactoring
csharp_style_expression_bodied_operators = true:refactoring
csharp_style_expression_bodied_properties = true:refactoring
csharp_style_expression_bodied_indexers = true:refactoring
csharp_style_expression_bodied_accessors = true:refactoring
csharp_style_expression_bodied_lambdas = true:refactoring
csharp_style_expression_bodied_local_functions = true:refactoring

# Pattern matching
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
csharp_style_inlined_variable_declaration = true:suggestion

# Null checking preferences
csharp_style_throw_expression = true:suggestion
csharp_style_conditional_delegate_call = true:suggestion

# Other features
csharp_style_prefer_index_operator = false:none
csharp_style_prefer_range_operator = false:none
csharp_style_pattern_local_over_anonymous_function = false:none

# Space preferences
csharp_space_after_cast = false
csharp_space_after_colon_in_inheritance_clause = true
csharp_space_after_comma = true
csharp_space_after_dot = false
csharp_space_after_keywords_in_control_flow_statements = true
csharp_space_after_semicolon_in_for_statement = true
csharp_space_around_binary_operators = before_and_after
csharp_space_around_declaration_statements = do_not_ignore
csharp_space_before_colon_in_inheritance_clause = true
csharp_space_before_comma = false
csharp_space_before_dot = false
csharp_space_before_open_square_brackets = false
csharp_space_before_semicolon_in_for_statement = false
csharp_space_between_empty_square_brackets = false
csharp_space_between_method_call_empty_parameter_list_parentheses = false
csharp_space_between_method_call_name_and_opening_parenthesis = false
csharp_space_between_method_call_parameter_list_parentheses = false
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
csharp_space_between_method_declaration_name_and_open_parenthesis = false
csharp_space_between_method_declaration_parameter_list_parentheses = false
csharp_space_between_parentheses = false
csharp_space_between_square_brackets = false

# Analyzers
dotnet_code_quality.ca1802.api_surface = private, internal

# C++ Files
[*.{cpp,h,in}]
curly_bracket_next_line = true
indent_brace_style = Allman

# Xml project files
[*.{csproj,vcxproj,vcxproj.filters,proj,nativeproj,locproj}]
indent_size = 2

# Xml build files
[*.builds]
indent_size = 2

# Xml files
[*.{xml,stylecop,resx,ruleset}]
indent_size = 2

# Xml config files
[*.{props,targets,config,nuspec}]
indent_size = 2

# Shell scripts
[*.sh]
end_of_line = lf
[*.{cmd, bat}]
end_of_line = crlf

================================================
FILE: .gitignore
================================================
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore

# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates

# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs

# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/

# Visual Studio 2015/2017 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/

# Visual Studio 2017 auto generated files
Generated\ Files/

# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*

# NUNIT
*.VisualState.xml
TestResult.xml

# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c

# Benchmark Results
BenchmarkDotNet.Artifacts/

# .NET Core
project.lock.json
project.fragment.lock.json
artifacts/
**/Properties/launchSettings.json

# StyleCop
StyleCopReport.xml

# Files built by Visual Studio
*_i.c
*_p.c
*_i.h
*.ilk
*.meta
*.obj
*.iobj
*.pch
*.pdb
*.ipdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc

# Chutzpah Test files
_Chutzpah*

# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb

# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap

# Visual Studio Trace Files
*.e2e

# TFS 2012 Local Workspace
$tf/

# Guidance Automation Toolkit
*.gpState

# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user

# JustCode is a .NET coding add-in
.JustCode

# TeamCity is a build add-in
_TeamCity*

# DotCover is a Code Coverage Tool
*.dotCover

# AxoCover is a Code Coverage Tool
.axoCover/*
!.axoCover/settings.json

# Visual Studio code coverage results
*.coverage
*.coveragexml

# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*

# MightyMoose
*.mm.*
AutoTest.Net/

# Web workbench (sass)
.sass-cache/

# Installshield output folder
[Ee]xpress/

# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html

# Click-Once directory
publish/

# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# Note: Comment the next line if you want to checkin your web deploy settings,
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj

# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/

# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/[Pp]ackages/*
# except build/, which is used as an MSBuild target.
!**/[Pp]ackages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/[Pp]ackages/repositories.config
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets

# Microsoft Azure Build Output
csx/
*.build.csdef

# Microsoft Azure Emulator
ecf/
rcf/

# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
*.appx

# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!*.[Cc]ache/

# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
orleans.codegen.cs

# Including strong name files can present a security risk 
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
#*.snk

# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/

# RIA/Silverlight projects
Generated_Code/

# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
ServiceFabricBackup/
*.rptproj.bak

# SQL Server files
*.mdf
*.ldf
*.ndf

# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
*.rptproj.rsuser

# Microsoft Fakes
FakesAssemblies/

# GhostDoc plugin setting file
*.GhostDoc.xml

# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/

# Visual Studio 6 build log
*.plg

# Visual Studio 6 workspace options file
*.opt

# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw

# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions

# Paket dependency manager
.paket/paket.exe
paket-files/

# FAKE - F# Make
.fake/

# JetBrains Rider
.idea/
*.sln.iml

# CodeRush
.cr/

# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc

# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config

# Tabs Studio
*.tss

# Telerik's JustMock configuration file
*.jmconfig

# BizTalk build output
*.btp.cs
*.btm.cs
*.odx.cs
*.xsd.cs

# OpenCover UI analysis results
OpenCover/

# Azure Stream Analytics local run output 
ASALocalRun/

# MSBuild Binary and Structured Log
*.binlog

# NVidia Nsight GPU debugger configuration file
*.nvuser

# MFractors (Xamarin productivity tool) working folder 
.mfractor/

.DS_Store


================================================
FILE: .vscode/launch.json
================================================
{
   // Use IntelliSense to find out which attributes exist for C# debugging
   // Use hover for the description of the existing attributes
   // For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
   "version": "0.2.0",
   "configurations": [
        {
            "name": ".NET Core Launch (console)",
            "type": "coreclr",
            "request": "launch",
            "preLaunchTask": "build",
            // If you have changed target frameworks, make sure to update the program path.
            "program": "${workspaceFolder}/test/UnitTests/bin/Debug/netcoreapp3.0/UnitTests.dll",
            "args": [],
            "cwd": "${workspaceFolder}/test/UnitTests",
            // For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console
            "console": "internalConsole",
            "stopAtEntry": false
        },
        {
            "name": ".NET Core Attach",
            "type": "coreclr",
            "request": "attach",
            "processId": "${command:pickProcess}"
        }
    ]
}

================================================
FILE: .vscode/settings.json
================================================
{
    "workbench.colorCustomizations": {
        "activityBar.background": "#2f7c47",
        "activityBar.activeBorder": "#422c74",
        "activityBar.foreground": "#e7e7e7",
        "activityBar.inactiveForeground": "#e7e7e799",
        "activityBarBadge.background": "#422c74",
        "activityBarBadge.foreground": "#e7e7e7",
        "titleBar.activeBackground": "#215732",
        "titleBar.inactiveBackground": "#21573299",
        "titleBar.activeForeground": "#e7e7e7",
        "titleBar.inactiveForeground": "#e7e7e799",
        "statusBar.background": "#215732",
        "statusBarItem.hoverBackground": "#2f7c47",
        "statusBar.foreground": "#e7e7e7"
    },
    "peacock.color": "#215732"
}

================================================
FILE: .vscode/tasks.json
================================================
{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "build",
            "command": "dotnet",
            "type": "process",
            "args": [
                "build",
                "${workspaceFolder}/test/UnitTests/UnitTests.csproj",
                "/property:GenerateFullPaths=true",
                "/consoleloggerparameters:NoSummary"
            ],
            "problemMatcher": "$msCompile"
        },
        {
            "label": "publish",
            "command": "dotnet",
            "type": "process",
            "args": [
                "publish",
                "${workspaceFolder}/test/UnitTests/UnitTests.csproj",
                "/property:GenerateFullPaths=true",
                "/consoleloggerparameters:NoSummary"
            ],
            "problemMatcher": "$msCompile"
        },
        {
            "label": "watch",
            "command": "dotnet",
            "type": "process",
            "args": [
                "watch",
                "run",
                "${workspaceFolder}/test/UnitTests/UnitTests.csproj",
                "/property:GenerateFullPaths=true",
                "/consoleloggerparameters:NoSummary"
            ],
            "problemMatcher": "$msCompile"
        }
    ]
}

================================================
FILE: FluentMediator.sln
================================================

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26124.0
MinimumVisualStudioVersion = 15.0.26124.0
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{2F50D282-F726-49F8-87B7-5662493EDBCA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FluentMediator", "src\FluentMediator\FluentMediator.csproj", "{21CE6BEA-C0A5-4676-A56A-7574E1373A0E}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{62742B03-49D2-429F-A928-3E6DCA724943}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTests", "test\UnitTests\UnitTests.csproj", "{3F9FB7FC-68CA-451D-9828-323F20FB3DB7}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FluentMediator.Microsoft.Extensions.DependencyInjection", "src\FluentMediator.Microsoft.Extensions.DependencyInjection\FluentMediator.Microsoft.Extensions.DependencyInjection.csproj", "{2E365BC8-38CB-4FAD-B186-85F053B2D53F}"
EndProject
Global
	GlobalSection(SolutionConfigurationPlatforms) = preSolution
		Debug|Any CPU = Debug|Any CPU
		Debug|x64 = Debug|x64
		Debug|x86 = Debug|x86
		Release|Any CPU = Release|Any CPU
		Release|x64 = Release|x64
		Release|x86 = Release|x86
	EndGlobalSection
	GlobalSection(SolutionProperties) = preSolution
		HideSolutionNode = FALSE
	EndGlobalSection
	GlobalSection(ProjectConfigurationPlatforms) = postSolution
		{21CE6BEA-C0A5-4676-A56A-7574E1373A0E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{21CE6BEA-C0A5-4676-A56A-7574E1373A0E}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{21CE6BEA-C0A5-4676-A56A-7574E1373A0E}.Debug|x64.ActiveCfg = Debug|Any CPU
		{21CE6BEA-C0A5-4676-A56A-7574E1373A0E}.Debug|x64.Build.0 = Debug|Any CPU
		{21CE6BEA-C0A5-4676-A56A-7574E1373A0E}.Debug|x86.ActiveCfg = Debug|Any CPU
		{21CE6BEA-C0A5-4676-A56A-7574E1373A0E}.Debug|x86.Build.0 = Debug|Any CPU
		{21CE6BEA-C0A5-4676-A56A-7574E1373A0E}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{21CE6BEA-C0A5-4676-A56A-7574E1373A0E}.Release|Any CPU.Build.0 = Release|Any CPU
		{21CE6BEA-C0A5-4676-A56A-7574E1373A0E}.Release|x64.ActiveCfg = Release|Any CPU
		{21CE6BEA-C0A5-4676-A56A-7574E1373A0E}.Release|x64.Build.0 = Release|Any CPU
		{21CE6BEA-C0A5-4676-A56A-7574E1373A0E}.Release|x86.ActiveCfg = Release|Any CPU
		{21CE6BEA-C0A5-4676-A56A-7574E1373A0E}.Release|x86.Build.0 = Release|Any CPU
		{3F9FB7FC-68CA-451D-9828-323F20FB3DB7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{3F9FB7FC-68CA-451D-9828-323F20FB3DB7}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{3F9FB7FC-68CA-451D-9828-323F20FB3DB7}.Debug|x64.ActiveCfg = Debug|Any CPU
		{3F9FB7FC-68CA-451D-9828-323F20FB3DB7}.Debug|x64.Build.0 = Debug|Any CPU
		{3F9FB7FC-68CA-451D-9828-323F20FB3DB7}.Debug|x86.ActiveCfg = Debug|Any CPU
		{3F9FB7FC-68CA-451D-9828-323F20FB3DB7}.Debug|x86.Build.0 = Debug|Any CPU
		{3F9FB7FC-68CA-451D-9828-323F20FB3DB7}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{3F9FB7FC-68CA-451D-9828-323F20FB3DB7}.Release|Any CPU.Build.0 = Release|Any CPU
		{3F9FB7FC-68CA-451D-9828-323F20FB3DB7}.Release|x64.ActiveCfg = Release|Any CPU
		{3F9FB7FC-68CA-451D-9828-323F20FB3DB7}.Release|x64.Build.0 = Release|Any CPU
		{3F9FB7FC-68CA-451D-9828-323F20FB3DB7}.Release|x86.ActiveCfg = Release|Any CPU
		{3F9FB7FC-68CA-451D-9828-323F20FB3DB7}.Release|x86.Build.0 = Release|Any CPU
		{2E365BC8-38CB-4FAD-B186-85F053B2D53F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{2E365BC8-38CB-4FAD-B186-85F053B2D53F}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{2E365BC8-38CB-4FAD-B186-85F053B2D53F}.Debug|x64.ActiveCfg = Debug|Any CPU
		{2E365BC8-38CB-4FAD-B186-85F053B2D53F}.Debug|x64.Build.0 = Debug|Any CPU
		{2E365BC8-38CB-4FAD-B186-85F053B2D53F}.Debug|x86.ActiveCfg = Debug|Any CPU
		{2E365BC8-38CB-4FAD-B186-85F053B2D53F}.Debug|x86.Build.0 = Debug|Any CPU
		{2E365BC8-38CB-4FAD-B186-85F053B2D53F}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{2E365BC8-38CB-4FAD-B186-85F053B2D53F}.Release|Any CPU.Build.0 = Release|Any CPU
		{2E365BC8-38CB-4FAD-B186-85F053B2D53F}.Release|x64.ActiveCfg = Release|Any CPU
		{2E365BC8-38CB-4FAD-B186-85F053B2D53F}.Release|x64.Build.0 = Release|Any CPU
		{2E365BC8-38CB-4FAD-B186-85F053B2D53F}.Release|x86.ActiveCfg = Release|Any CPU
		{2E365BC8-38CB-4FAD-B186-85F053B2D53F}.Release|x86.Build.0 = Release|Any CPU
	EndGlobalSection
	GlobalSection(NestedProjects) = preSolution
		{21CE6BEA-C0A5-4676-A56A-7574E1373A0E} = {2F50D282-F726-49F8-87B7-5662493EDBCA}
		{3F9FB7FC-68CA-451D-9828-323F20FB3DB7} = {62742B03-49D2-429F-A928-3E6DCA724943}
		{2E365BC8-38CB-4FAD-B186-85F053B2D53F} = {2F50D282-F726-49F8-87B7-5662493EDBCA}
	EndGlobalSection
EndGlobal


================================================
FILE: LICENSE
================================================
                                 Apache License
                           Version 2.0, January 2004
                        http://www.apache.org/licenses/

   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

   1. Definitions.

      "License" shall mean the terms and conditions for use, reproduction,
      and distribution as defined by Sections 1 through 9 of this document.

      "Licensor" shall mean the copyright owner or entity authorized by
      the copyright owner that is granting the License.

      "Legal Entity" shall mean the union of the acting entity and all
      other entities that control, are controlled by, or are under common
      control with that entity. For the purposes of this definition,
      "control" means (i) the power, direct or indirect, to cause the
      direction or management of such entity, whether by contract or
      otherwise, or (ii) ownership of fifty percent (50%) or more of the
      outstanding shares, or (iii) beneficial ownership of such entity.

      "You" (or "Your") shall mean an individual or Legal Entity
      exercising permissions granted by this License.

      "Source" form shall mean the preferred form for making modifications,
      including but not limited to software source code, documentation
      source, and configuration files.

      "Object" form shall mean any form resulting from mechanical
      transformation or translation of a Source form, including but
      not limited to compiled object code, generated documentation,
      and conversions to other media types.

      "Work" shall mean the work of authorship, whether in Source or
      Object form, made available under the License, as indicated by a
      copyright notice that is included in or attached to the work
      (an example is provided in the Appendix below).

      "Derivative Works" shall mean any work, whether in Source or Object
      form, that is based on (or derived from) the Work and for which the
      editorial revisions, annotations, elaborations, or other modifications
      represent, as a whole, an original work of authorship. For the purposes
      of this License, Derivative Works shall not include works that remain
      separable from, or merely link (or bind by name) to the interfaces of,
      the Work and Derivative Works thereof.

      "Contribution" shall mean any work of authorship, including
      the original version of the Work and any modifications or additions
      to that Work or Derivative Works thereof, that is intentionally
      submitted to Licensor for inclusion in the Work by the copyright owner
      or by an individual or Legal Entity authorized to submit on behalf of
      the copyright owner. For the purposes of this definition, "submitted"
      means any form of electronic, verbal, or written communication sent
      to the Licensor or its representatives, including but not limited to
      communication on electronic mailing lists, source code control systems,
      and issue tracking systems that are managed by, or on behalf of, the
      Licensor for the purpose of discussing and improving the Work, but
      excluding communication that is conspicuously marked or otherwise
      designated in writing by the copyright owner as "Not a Contribution."

      "Contributor" shall mean Licensor and any individual or Legal Entity
      on behalf of whom a Contribution has been received by Licensor and
      subsequently incorporated within the Work.

   2. Grant of Copyright License. Subject to the terms and conditions of
      this License, each Contributor hereby grants to You a perpetual,
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
      copyright license to reproduce, prepare Derivative Works of,
      publicly display, publicly perform, sublicense, and distribute the
      Work and such Derivative Works in Source or Object form.

   3. Grant of Patent License. Subject to the terms and conditions of
      this License, each Contributor hereby grants to You a perpetual,
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
      (except as stated in this section) patent license to make, have made,
      use, offer to sell, sell, import, and otherwise transfer the Work,
      where such license applies only to those patent claims licensable
      by such Contributor that are necessarily infringed by their
      Contribution(s) alone or by combination of their Contribution(s)
      with the Work to which such Contribution(s) was submitted. If You
      institute patent litigation against any entity (including a
      cross-claim or counterclaim in a lawsuit) alleging that the Work
      or a Contribution incorporated within the Work constitutes direct
      or contributory patent infringement, then any patent licenses
      granted to You under this License for that Work shall terminate
      as of the date such litigation is filed.

   4. Redistribution. You may reproduce and distribute copies of the
      Work or Derivative Works thereof in any medium, with or without
      modifications, and in Source or Object form, provided that You
      meet the following conditions:

      (a) You must give any other recipients of the Work or
          Derivative Works a copy of this License; and

      (b) You must cause any modified files to carry prominent notices
          stating that You changed the files; and

      (c) You must retain, in the Source form of any Derivative Works
          that You distribute, all copyright, patent, trademark, and
          attribution notices from the Source form of the Work,
          excluding those notices that do not pertain to any part of
          the Derivative Works; and

      (d) If the Work includes a "NOTICE" text file as part of its
          distribution, then any Derivative Works that You distribute must
          include a readable copy of the attribution notices contained
          within such NOTICE file, excluding those notices that do not
          pertain to any part of the Derivative Works, in at least one
          of the following places: within a NOTICE text file distributed
          as part of the Derivative Works; within the Source form or
          documentation, if provided along with the Derivative Works; or,
          within a display generated by the Derivative Works, if and
          wherever such third-party notices normally appear. The contents
          of the NOTICE file are for informational purposes only and
          do not modify the License. You may add Your own attribution
          notices within Derivative Works that You distribute, alongside
          or as an addendum to the NOTICE text from the Work, provided
          that such additional attribution notices cannot be construed
          as modifying the License.

      You may add Your own copyright statement to Your modifications and
      may provide additional or different license terms and conditions
      for use, reproduction, or distribution of Your modifications, or
      for any such Derivative Works as a whole, provided Your use,
      reproduction, and distribution of the Work otherwise complies with
      the conditions stated in this License.

   5. Submission of Contributions. Unless You explicitly state otherwise,
      any Contribution intentionally submitted for inclusion in the Work
      by You to the Licensor shall be under the terms and conditions of
      this License, without any additional terms or conditions.
      Notwithstanding the above, nothing herein shall supersede or modify
      the terms of any separate license agreement you may have executed
      with Licensor regarding such Contributions.

   6. Trademarks. This License does not grant permission to use the trade
      names, trademarks, service marks, or product names of the Licensor,
      except as required for reasonable and customary use in describing the
      origin of the Work and reproducing the content of the NOTICE file.

   7. Disclaimer of Warranty. Unless required by applicable law or
      agreed to in writing, Licensor provides the Work (and each
      Contributor provides its Contributions) on an "AS IS" BASIS,
      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
      implied, including, without limitation, any warranties or conditions
      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
      PARTICULAR PURPOSE. You are solely responsible for determining the
      appropriateness of using or redistributing the Work and assume any
      risks associated with Your exercise of permissions under this License.

   8. Limitation of Liability. In no event and under no legal theory,
      whether in tort (including negligence), contract, or otherwise,
      unless required by applicable law (such as deliberate and grossly
      negligent acts) or agreed to in writing, shall any Contributor be
      liable to You for damages, including any direct, indirect, special,
      incidental, or consequential damages of any character arising as a
      result of this License or out of the use or inability to use the
      Work (including but not limited to damages for loss of goodwill,
      work stoppage, computer failure or malfunction, or any and all
      other commercial damages or losses), even if such Contributor
      has been advised of the possibility of such damages.

   9. Accepting Warranty or Additional Liability. While redistributing
      the Work or Derivative Works thereof, You may choose to offer,
      and charge a fee for, acceptance of support, warranty, indemnity,
      or other liability obligations and/or rights consistent with this
      License. However, in accepting such obligations, You may act only
      on Your own behalf and on Your sole responsibility, not on behalf
      of any other Contributor, and only if You agree to indemnify,
      defend, and hold each Contributor harmless for any liability
      incurred by, or claims asserted against, such Contributor by reason
      of your accepting any such warranty or additional liability.

   END OF TERMS AND CONDITIONS

   APPENDIX: How to apply the Apache License to your work.

      To apply the Apache License to your work, attach the following
      boilerplate notice, with the fields enclosed by brackets "[]"
      replaced with your own identifying information. (Don't include
      the brackets!)  The text should be enclosed in the appropriate
      comment syntax for the file format. We also recommend that a
      file or class name and description of purpose be included on the
      same "printed page" as the copyright notice for easier
      identification within third-party archives.

   Copyright [yyyy] [name of copyright owner]

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.


================================================
FILE: README.md
================================================
# FluentMediator
[![Build Status](https://ivanpaulovich.visualstudio.com/FluentMediator/_apis/build/status/ivanpaulovich.FluentMediator?branchName=master)](https://ivanpaulovich.visualstudio.com/FluentMediator/_build/latest?definitionId=24&branchName=master) [![All Contributors](https://img.shields.io/badge/all_contributors-3-orange.svg?style=flat-square)](#contributors) ![GitHub issues](https://img.shields.io/github/issues/ivanpaulovich/FluentMediator) ![GitHub pull requests](https://img.shields.io/github/issues-pr/ivanpaulovich/FluentMediator) <a href="https://www.nuget.org/packages/FluentMediator/" rel="Paulovich.Caju">![NuGet](https://buildstats.info/nuget/FluentMediator)</a>

:twisted_rightwards_arrows: We will not require you to add dependencies into your domain or to implement frameworks interfaces in your event handlers. Finally a really loosely coupled mediator library was born.

## Install

```
Install-Package FluentMediator
```

For seameless .NET Core integration:

```
Install-Package FluentMediator.Microsoft.Extensions.DependencyInjection
```

## How

Setup your events and pipelines using depedency injection. You can be very creative here! It supports async methods and cancellable tokens parameters, you could append multiple steps select one to return a message. An example:

```c#
services.AddFluentMediator(builder => {
    builder.On<PingRequest>().Pipeline()
        .Call<IPingHandler>((handler, request) => handler.MyMethod(request))
        .Call<IPingHandler>((handler, request) => handler.MyLongMethod(request))
        .Return<PingResponse, IPingHandler>(
            (handler, request) => handler.MyOtherMethod(request)
        );
});
```

Then you are able to use the injected `IMediator` interface.

### Publishing Events

```c#
// Puts the message in the pipeline, calls three handlers.
mediator.Publish<PingRequest>(ping);
```

### Sending Commands and Queries

```c#
// Calls the three handlers then get the response from `MyOtherMethod(PingRequest)`.
PingResponse response = mediator.Send<PingResponse>(new PingRequest("Ping"));
Console.WriteLine(response.Message); // Prints "Pong"
```

## Why

When designing *CQRS* or *Event-Driven* applications we need to publish events from the infrastructure layer into the *domain event handlers*. We do not want framework dependencies leaking out to the Model then **FluentMediator** was born. 

## Contributors

<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
<!-- prettier-ignore -->
<table>
  <tr>
    <td align="center"><a href="https://paulovich.net"><img src="https://avatars3.githubusercontent.com/u/7133698?v=4" width="100px;" alt="Ivan Paulovich"/><br /><sub><b>Ivan Paulovich</b></sub></a><br /><a href="https://github.com/ivanpaulovich/FluentMediator/commits?author=ivanpaulovich" title="Code">💻</a> <a href="#design-ivanpaulovich" title="Design">🎨</a> <a href="https://github.com/ivanpaulovich/FluentMediator/commits?author=ivanpaulovich" title="Tests">⚠️</a></td>
    <td align="center"><a href="http://www.carselind.se"><img src="https://avatars1.githubusercontent.com/u/439028?v=4" width="100px;" alt="Joakim Carselind"/><br /><sub><b>Joakim Carselind</b></sub></a><br /><a href="#review-joacar" title="Reviewed Pull Requests">👀</a> <a href="#ideas-joacar" title="Ideas, Planning, & Feedback">🤔</a></td>
    <td align="center"><a href="https://github.com/vag1830"><img src="https://avatars2.githubusercontent.com/u/1694870?v=4" width="100px;" alt="Vaggelis Mparmpas"/><br /><sub><b>Vaggelis Mparmpas</b></sub></a><br /><a href="https://github.com/ivanpaulovich/FluentMediator/commits?author=vag1830" title="Tests">⚠️</a></td>
  </tr>
</table>

<!-- ALL-CONTRIBUTORS-LIST:END -->

Please contribute with [Issues](https://github.com/ivanpaulovich/FluentMediator/issues), [Wiki](https://github.com/ivanpaulovich/FluentMediator/wiki) and [Samples](https://github.com/ivanpaulovich/FluentMediator/tree/master/samples).


================================================
FILE: azure-pipelines-1.yml
================================================
# ASP.NET Core (.NET Framework)
# Build and test ASP.NET Core projects targeting the full .NET Framework.
# Add steps that publish symbols, save build artifacts, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/dotnet-core

trigger:
  tags:
    include:
    - v*

pool:
  vmImage: 'windows-latest'

variables:
  solution: '**/*.sln'
  buildPlatform: 'Any CPU'
  buildConfiguration: 'Release'

steps:
- task: NuGetToolInstaller@1

- task: NuGetCommand@2
  inputs:
    restoreSolution: '$(solution)'

- task: VSBuild@1
  inputs:
    solution: '$(solution)'
    msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:DesktopBuildPackageLocation="$(build.artifactStagingDirectory)\WebApp.zip" /p:DeployIisAppPath="Default Web Site"'
    platform: '$(buildPlatform)'
    configuration: '$(buildConfiguration)'

- task: DotNetCoreCLI@2
  inputs:
    command: 'test'
    projects: 'test/UnitTests/UnitTests.csproj'
    testRunTitle: 'Test'

- task: DotNetCoreCLI@2
  inputs:
    command: 'pack'
    packagesToPack: 'src/**/*.csproj'
    nobuild: true
    includesymbols: true
    includesource: true
    versioningScheme: 'off'
    
- task: GitHubRelease@1
  inputs:
    gitHubConnection: ivanpaulovich-github
    repositoryName: '$(Build.Repository.Name)'
    action: 'create'
    target: '$(Build.SourceVersion)'
    tagSource: 'gitTag'
    changeLogCompareToRelease: 'lastFullRelease'
    changeLogType: 'commitBased'

- task: NuGetCommand@2
  inputs:
    command: 'push'
    packagesToPush: '$(Build.ArtifactStagingDirectory)/**/*.nupkg;!$(Build.ArtifactStagingDirectory)/**/*.symbols.nupkg'
    nuGetFeedType: 'external'
    publishFeedCredentials: 'NugetOrg'

================================================
FILE: azure-pipelines.yml
================================================
# ASP.NET Core (.NET Framework)
# Build and test ASP.NET Core projects targeting the full .NET Framework.
# Add steps that publish symbols, save build artifacts, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/dotnet-core

trigger:
- master

pool:
  vmImage: 'windows-latest'

variables:
  solution: '**/*.sln'
  buildPlatform: 'Any CPU'
  buildConfiguration: 'Release'

steps:
- task: NuGetToolInstaller@1

- task: NuGetCommand@2
  inputs:
    restoreSolution: '$(solution)'

- task: VSBuild@1
  inputs:
    solution: '$(solution)'
    msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:DesktopBuildPackageLocation="$(build.artifactStagingDirectory)\WebApp.zip" /p:DeployIisAppPath="Default Web Site"'
    platform: '$(buildPlatform)'
    configuration: '$(buildConfiguration)'

- task: DotNetCoreCLI@2
  inputs:
    command: 'test'
    projects: 'test/UnitTests/UnitTests.csproj'
    testRunTitle: 'Test'

================================================
FILE: changelog.md
================================================
# Change Log

## 2020-02-04 - 0.4.7

- #48 Changed `PipelineNotFoundException` to internal.
- #48 Removed sealed modified from Mediator to allow derived implementations.
- #48 Added `OnPipelineNotFound` event to `IMediator` interface.
- #48 Added `void OnPipelineNotFound(PipelineNotFoundEventArgs e)` handler to `Mediator` class.

## 2019-10-20 - 0.4.6

* #25 Cancellation Token fixed.
* Added XML docs.

## 2019-10-20 - 0.4.5

* #37 Validation for Null Requests added.

## 2019-10-20 - 0.4.3

* #2 Support o Named Pipelines Added.

## 2019-10-20 - 0.4.0

* Refactoring.

## 2019-10-19 - 0.3.3

* #31 Support Scoped & Transient Lifetime.
* Refactoring Tests.

## 2019-10-19 - 0.3.2

* Nuget Package Metadata added.

## 2019-10-13 - 0.3.1

* Implementation details made internal.

## 2019-10-13 - 0.3.0

* #32 Segregated Builder and Messaging interfaces.
* #31 Support Scoped & Transient Lifetime.

## 2019-10-13 - 0.2.0

* #27 Added PipelineAlreadyExistsException.
* #27 Added PipelineNotFoundException.

## 2019-10-13 - 0.1.0

* #24 Added ReturnFunctionIsNullException for misconfigured Pipelines.
* SendAsync(request, ct) added to the public interfaces.
* Refactoring.


================================================
FILE: samples/AspNetCore/.vscode/launch.json
================================================
{
   // Use IntelliSense to find out which attributes exist for C# debugging
   // Use hover for the description of the existing attributes
   // For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
   "version": "0.2.0",
   "configurations": [
        {
            "name": ".NET Core Launch (web)",
            "type": "coreclr",
            "request": "launch",
            "preLaunchTask": "build",
            // If you have changed target frameworks, make sure to update the program path.
            "program": "${workspaceFolder}/src/WebApi/bin/Debug/netcoreapp3.0/WebApi.dll",
            "args": [],
            "cwd": "${workspaceFolder}/src/WebApi",
            "stopAtEntry": false,
            // Enable launching a web browser when ASP.NET Core starts. For more information: https://aka.ms/VSCode-CS-LaunchJson-WebBrowser
            "serverReadyAction": {
                "action": "openExternally",
                "pattern": "^\\s*Now listening on:\\s+(https?://\\S+)"                
            },
            "env": {
                "ASPNETCORE_ENVIRONMENT": "Development"
            },
            "sourceFileMap": {
                "/Views": "${workspaceFolder}/Views"
            }
        },
        {
            "name": ".NET Core Attach",
            "type": "coreclr",
            "request": "attach",
            "processId": "${command:pickProcess}"
        }
    ]
}

================================================
FILE: samples/AspNetCore/.vscode/tasks.json
================================================
{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "build",
            "command": "dotnet",
            "type": "process",
            "args": [
                "build",
                "${workspaceFolder}/src/WebApi/WebApi.csproj",
                "/property:GenerateFullPaths=true",
                "/consoleloggerparameters:NoSummary"
            ],
            "problemMatcher": "$msCompile"
        },
        {
            "label": "publish",
            "command": "dotnet",
            "type": "process",
            "args": [
                "publish",
                "${workspaceFolder}/src/WebApi/WebApi.csproj",
                "/property:GenerateFullPaths=true",
                "/consoleloggerparameters:NoSummary"
            ],
            "problemMatcher": "$msCompile"
        },
        {
            "label": "watch",
            "command": "dotnet",
            "type": "process",
            "args": [
                "watch",
                "run",
                "${workspaceFolder}/src/WebApi/WebApi.csproj",
                "/property:GenerateFullPaths=true",
                "/consoleloggerparameters:NoSummary"
            ],
            "problemMatcher": "$msCompile"
        }
    ]
}

================================================
FILE: samples/AspNetCore/Wallet.sln
================================================

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26124.0
MinimumVisualStudioVersion = 15.0.26124.0
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{E199B813-DCAA-4DED-A175-38BFE58E37C2}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Core", "src\Core\Core.csproj", "{8072924A-5C32-49C3-9314-40B1B274A572}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Infrastructure", "src\Infrastructure\Infrastructure.csproj", "{93CE9A2D-B055-4E18-B7DE-C59441A02A84}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebApi", "src\WebApi\WebApi.csproj", "{E6077B21-BD4C-4F90-B6F8-3C2F88994A8F}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{8660B991-2482-4B36-BDBF-873136F571AD}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTests", "test\UnitTests\UnitTests.csproj", "{34641012-F6D1-46FD-95EC-BC03E79AC67F}"
EndProject
Global
	GlobalSection(SolutionConfigurationPlatforms) = preSolution
		Debug|Any CPU = Debug|Any CPU
		Debug|x64 = Debug|x64
		Debug|x86 = Debug|x86
		Release|Any CPU = Release|Any CPU
		Release|x64 = Release|x64
		Release|x86 = Release|x86
	EndGlobalSection
	GlobalSection(SolutionProperties) = preSolution
		HideSolutionNode = FALSE
	EndGlobalSection
	GlobalSection(ProjectConfigurationPlatforms) = postSolution
		{8072924A-5C32-49C3-9314-40B1B274A572}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{8072924A-5C32-49C3-9314-40B1B274A572}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{8072924A-5C32-49C3-9314-40B1B274A572}.Debug|x64.ActiveCfg = Debug|Any CPU
		{8072924A-5C32-49C3-9314-40B1B274A572}.Debug|x64.Build.0 = Debug|Any CPU
		{8072924A-5C32-49C3-9314-40B1B274A572}.Debug|x86.ActiveCfg = Debug|Any CPU
		{8072924A-5C32-49C3-9314-40B1B274A572}.Debug|x86.Build.0 = Debug|Any CPU
		{8072924A-5C32-49C3-9314-40B1B274A572}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{8072924A-5C32-49C3-9314-40B1B274A572}.Release|Any CPU.Build.0 = Release|Any CPU
		{8072924A-5C32-49C3-9314-40B1B274A572}.Release|x64.ActiveCfg = Release|Any CPU
		{8072924A-5C32-49C3-9314-40B1B274A572}.Release|x64.Build.0 = Release|Any CPU
		{8072924A-5C32-49C3-9314-40B1B274A572}.Release|x86.ActiveCfg = Release|Any CPU
		{8072924A-5C32-49C3-9314-40B1B274A572}.Release|x86.Build.0 = Release|Any CPU
		{93CE9A2D-B055-4E18-B7DE-C59441A02A84}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{93CE9A2D-B055-4E18-B7DE-C59441A02A84}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{93CE9A2D-B055-4E18-B7DE-C59441A02A84}.Debug|x64.ActiveCfg = Debug|Any CPU
		{93CE9A2D-B055-4E18-B7DE-C59441A02A84}.Debug|x64.Build.0 = Debug|Any CPU
		{93CE9A2D-B055-4E18-B7DE-C59441A02A84}.Debug|x86.ActiveCfg = Debug|Any CPU
		{93CE9A2D-B055-4E18-B7DE-C59441A02A84}.Debug|x86.Build.0 = Debug|Any CPU
		{93CE9A2D-B055-4E18-B7DE-C59441A02A84}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{93CE9A2D-B055-4E18-B7DE-C59441A02A84}.Release|Any CPU.Build.0 = Release|Any CPU
		{93CE9A2D-B055-4E18-B7DE-C59441A02A84}.Release|x64.ActiveCfg = Release|Any CPU
		{93CE9A2D-B055-4E18-B7DE-C59441A02A84}.Release|x64.Build.0 = Release|Any CPU
		{93CE9A2D-B055-4E18-B7DE-C59441A02A84}.Release|x86.ActiveCfg = Release|Any CPU
		{93CE9A2D-B055-4E18-B7DE-C59441A02A84}.Release|x86.Build.0 = Release|Any CPU
		{E6077B21-BD4C-4F90-B6F8-3C2F88994A8F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{E6077B21-BD4C-4F90-B6F8-3C2F88994A8F}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{E6077B21-BD4C-4F90-B6F8-3C2F88994A8F}.Debug|x64.ActiveCfg = Debug|Any CPU
		{E6077B21-BD4C-4F90-B6F8-3C2F88994A8F}.Debug|x64.Build.0 = Debug|Any CPU
		{E6077B21-BD4C-4F90-B6F8-3C2F88994A8F}.Debug|x86.ActiveCfg = Debug|Any CPU
		{E6077B21-BD4C-4F90-B6F8-3C2F88994A8F}.Debug|x86.Build.0 = Debug|Any CPU
		{E6077B21-BD4C-4F90-B6F8-3C2F88994A8F}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{E6077B21-BD4C-4F90-B6F8-3C2F88994A8F}.Release|Any CPU.Build.0 = Release|Any CPU
		{E6077B21-BD4C-4F90-B6F8-3C2F88994A8F}.Release|x64.ActiveCfg = Release|Any CPU
		{E6077B21-BD4C-4F90-B6F8-3C2F88994A8F}.Release|x64.Build.0 = Release|Any CPU
		{E6077B21-BD4C-4F90-B6F8-3C2F88994A8F}.Release|x86.ActiveCfg = Release|Any CPU
		{E6077B21-BD4C-4F90-B6F8-3C2F88994A8F}.Release|x86.Build.0 = Release|Any CPU
		{34641012-F6D1-46FD-95EC-BC03E79AC67F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{34641012-F6D1-46FD-95EC-BC03E79AC67F}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{34641012-F6D1-46FD-95EC-BC03E79AC67F}.Debug|x64.ActiveCfg = Debug|Any CPU
		{34641012-F6D1-46FD-95EC-BC03E79AC67F}.Debug|x64.Build.0 = Debug|Any CPU
		{34641012-F6D1-46FD-95EC-BC03E79AC67F}.Debug|x86.ActiveCfg = Debug|Any CPU
		{34641012-F6D1-46FD-95EC-BC03E79AC67F}.Debug|x86.Build.0 = Debug|Any CPU
		{34641012-F6D1-46FD-95EC-BC03E79AC67F}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{34641012-F6D1-46FD-95EC-BC03E79AC67F}.Release|Any CPU.Build.0 = Release|Any CPU
		{34641012-F6D1-46FD-95EC-BC03E79AC67F}.Release|x64.ActiveCfg = Release|Any CPU
		{34641012-F6D1-46FD-95EC-BC03E79AC67F}.Release|x64.Build.0 = Release|Any CPU
		{34641012-F6D1-46FD-95EC-BC03E79AC67F}.Release|x86.ActiveCfg = Release|Any CPU
		{34641012-F6D1-46FD-95EC-BC03E79AC67F}.Release|x86.Build.0 = Release|Any CPU
	EndGlobalSection
	GlobalSection(NestedProjects) = preSolution
		{8072924A-5C32-49C3-9314-40B1B274A572} = {E199B813-DCAA-4DED-A175-38BFE58E37C2}
		{93CE9A2D-B055-4E18-B7DE-C59441A02A84} = {E199B813-DCAA-4DED-A175-38BFE58E37C2}
		{E6077B21-BD4C-4F90-B6F8-3C2F88994A8F} = {E199B813-DCAA-4DED-A175-38BFE58E37C2}
		{34641012-F6D1-46FD-95EC-BC03E79AC67F} = {8660B991-2482-4B36-BDBF-873136F571AD}
	EndGlobalSection
EndGlobal


================================================
FILE: samples/AspNetCore/src/Core/Core.csproj
================================================
<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>netstandard2.1</TargetFramework>
    <Nullable>enable</Nullable>
    <NullableReferenceTypes>true</NullableReferenceTypes>
    <LangVersion>8.0</LangVersion>
    <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
  </PropertyGroup>

</Project>


================================================
FILE: samples/AspNetCore/src/Core/Services/ICustomerRepository.cs
================================================
using Core.Wallet;

namespace Core.Services
{
    public interface ICustomerRepository
    {
        void Add(Customer customer);
    }
}

================================================
FILE: samples/AspNetCore/src/Core/UseCases/IRegisterUseCase.cs
================================================
namespace Core.UseCases
{
    public interface IRegisterUseCase
    {
        RegisterResponse Execute(RegisterCommand registerCommand);
    }
}

================================================
FILE: samples/AspNetCore/src/Core/UseCases/Register.cs
================================================
using Core.Services;
using Core.Wallet;

namespace Core.UseCases
{
    public class Register : IRegisterUseCase
    {
        private readonly ICustomerRepository _customerRepository;

        public Register(ICustomerRepository customerRepository)
        {
            _customerRepository = customerRepository;
        }

        public RegisterResponse Execute(RegisterCommand registerCommand)
        {
            var customer = new Customer(
                registerCommand.Name,
                registerCommand.SSN,
                registerCommand.Balance
            );

            _customerRepository.Add(customer);

            return new RegisterResponse(customer.Id);
        }
    }
}

================================================
FILE: samples/AspNetCore/src/Core/UseCases/RegisterCommand.cs
================================================
namespace Core.UseCases
{
    public class RegisterCommand
    {
        public string Name { get; private set; }
        public string SSN { get; private set; }
        public decimal Balance { get; private set; }

        public RegisterCommand(string name, string ssn, decimal balance)
        {
            Name = name;
            SSN = ssn;
            Balance = balance;
        }
    }
}

================================================
FILE: samples/AspNetCore/src/Core/UseCases/RegisterResponse.cs
================================================
using System;

namespace Core.UseCases
{
    public class RegisterResponse
    {
        public Guid UserId { get; private set; }

        public RegisterResponse(Guid userId)
        {
            UserId = userId;
        }
    }
}

================================================
FILE: samples/AspNetCore/src/Core/Wallet/Customer.cs
================================================
using System;

namespace Core.Wallet
{
    public class Customer
    {
        public Guid Id { get; protected set; }
        public string Name { get; protected set; }
        public string SSN { get; protected set; }
        public decimal Balance { get; protected set; }
        public DateTime Timestamp { get; protected set; }

        public Customer(string name, string ssn, decimal balance)
        {
            Id = Guid.NewGuid();
            Name = name;
            SSN = ssn;
            Balance = balance;
            Timestamp = DateTime.Now;
        }
    }
}

================================================
FILE: samples/AspNetCore/src/Infrastructure/InMemory/CustomerRepository.cs
================================================
using System.Collections.Generic;
using Core.Services;
using Core.Wallet;

namespace Infrastructure.InMemory
{
    public class CustomerRepository : ICustomerRepository
    {
        public IList<Customer> Customers { get; }

        public CustomerRepository()
        {
            Customers = new List<Customer>();
        }

        public void Add(Customer customer)
        {
            Customers.Add(customer);
        }
    }
}

================================================
FILE: samples/AspNetCore/src/Infrastructure/Infrastructure.csproj
================================================
<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>netstandard2.1</TargetFramework>
    <Nullable>enable</Nullable>
    <NullableReferenceTypes>true</NullableReferenceTypes>
    <LangVersion>8.0</LangVersion>
    <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
  </PropertyGroup>

  <ItemGroup>
    <ProjectReference Include="..\Core\Core.csproj" />
  </ItemGroup>
  
</Project>


================================================
FILE: samples/AspNetCore/src/WebApi/Controllers/Register/CustomersController.cs
================================================
using System.ComponentModel.DataAnnotations;
using Core.UseCases;
using FluentMediator;
using Microsoft.AspNetCore.Mvc;

namespace WebApi.Controllers.Register
{
    [Route("api/[controller]")]
    [ApiController]
    public class CustomersController : ControllerBase
    {
        private readonly IMediator _mediator;

        public CustomersController(IMediator mediator)
        {
            _mediator = mediator;
        }

        [HttpPost]
        public IActionResult Post([FromBody][Required] RegisterRequest request)
        {
            var registerCommand = new RegisterCommand(
                request.Name,
                request.SSN,
                request.Balance
            );

            var response = _mediator.Send<RegisterResponse>(registerCommand);

            return Ok(response);
        }
    }
}

================================================
FILE: samples/AspNetCore/src/WebApi/Controllers/Register/RegisterRequest.cs
================================================
namespace WebApi.Controllers.Register
{
    public class RegisterRequest
    {
        public string Name { get; set; }
        public string SSN { get; set; }
        public decimal Balance { get; set; }
    }
}

================================================
FILE: samples/AspNetCore/src/WebApi/Program.cs
================================================
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;

namespace WebApi
{
    public class Program
    {
        public static void Main(string[] args)
        {
            CreateHostBuilder(args).Build().Run();
        }

        public static IHostBuilder CreateHostBuilder(string[] args) =>
            Host.CreateDefaultBuilder(args)
            .ConfigureWebHostDefaults(webBuilder =>
            {
                webBuilder.UseStartup<Startup>();
            });
    }
}

================================================
FILE: samples/AspNetCore/src/WebApi/Startup.cs
================================================
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Core.Services;
using Core.UseCases;
using FluentMediator;
using Infrastructure.InMemory;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.HttpsPolicy;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;

namespace WebApi
{
    public class Startup
    {
        public Startup(IConfiguration configuration)
        {
            Configuration = configuration;
        }

        public IConfiguration Configuration { get; }

        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddControllers();

            services.AddTransient<IRegisterUseCase, Register>();
            services.AddTransient<ICustomerRepository, CustomerRepository>();

            services.AddFluentMediator(builder =>
            {
                builder.On<RegisterCommand>().Pipeline()
                    .Return<RegisterResponse, IRegisterUseCase>(
                        (handler, request) => handler.Execute(request));
            });
        }

        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.UseHttpsRedirection();

            app.UseRouting();

            app.UseAuthorization();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();
            });
        }
    }
}

================================================
FILE: samples/AspNetCore/src/WebApi/WebApi.csproj
================================================
<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup>
    <TargetFramework>netcoreapp3.0</TargetFramework>
    <AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
  </PropertyGroup>

  <ItemGroup>
    <ProjectReference Include="..\Core\Core.csproj" />
    <ProjectReference Include="..\Infrastructure\Infrastructure.csproj" />
  </ItemGroup>

  <ItemGroup>
    <ProjectReference Include="..\..\..\..\src\FluentMediator\FluentMediator.csproj" />
    <ProjectReference Include="..\..\..\..\src\FluentMediator.Microsoft.Extensions.DependencyInjection\FluentMediator.Microsoft.Extensions.DependencyInjection.csproj" />
  </ItemGroup>

</Project>


================================================
FILE: samples/AspNetCore/src/WebApi/appsettings.Development.json
================================================
{
  "Logging": {
    "LogLevel": {
      "Default": "Debug",
      "System": "Information",
      "Microsoft": "Information"
    }
  }
}


================================================
FILE: samples/AspNetCore/src/WebApi/appsettings.json
================================================
{
  "Logging": {
    "LogLevel": {
      "Default": "Information",
      "Microsoft": "Warning",
      "Microsoft.Hosting.Lifetime": "Information"
    }
  },
  "AllowedHosts": "*"
}


================================================
FILE: samples/AspNetCore/test/UnitTests/UnitTests.csproj
================================================
<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>netcoreapp3.0</TargetFramework>
    <IsPackable>false</IsPackable>
    <Nullable>enable</Nullable>
    <NullableReferenceTypes>true</NullableReferenceTypes>
    <LangVersion>8.0</LangVersion>
    <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.3.0" />
    <PackageReference Include="xunit" Version="2.4.1" />
    <PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" />
    <PackageReference Include="coverlet.collector" Version="1.1.0" />
    <PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="3.0.0" />
  </ItemGroup>

  <ItemGroup>
    <ProjectReference Include="..\..\src\Core\Core.csproj" />
    <ProjectReference Include="..\..\src\Infrastructure\Infrastructure.csproj" />
  </ItemGroup>

</Project>


================================================
FILE: samples/AspNetCore/test/UnitTests/UseCasesTests/RegisterTests.cs
================================================
using Core.UseCases;
using Infrastructure.InMemory;
using Xunit;

namespace UnitTests.UseCasesTests
{
    public class RegisterTests
    {
        [Fact]
        public void Register_PublishesEvent()
        {
            // Arrange
            var customerRepository = new CustomerRepository();
            var sut = new Register(customerRepository);
            var registerCommand = new RegisterCommand(
                "Ivan Paulovich",
                "198608175555",
                460
            );
            
            // Act
            var response = sut.Execute(registerCommand);
            
            // Assert
            Assert.NotEmpty(customerRepository.Customers);
        }
    }
}

================================================
FILE: samples/SimpleConsoleApp/.vscode/launch.json
================================================
{
   // Use IntelliSense to find out which attributes exist for C# debugging
   // Use hover for the description of the existing attributes
   // For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
   "version": "0.2.0",
   "configurations": [
        {
            "name": ".NET Core Launch (console)",
            "type": "coreclr",
            "request": "launch",
            "preLaunchTask": "build",
            // If you have changed target frameworks, make sure to update the program path.
            "program": "${workspaceFolder}/PingPong/bin/Debug/netcoreapp3.0/PingPong.dll",
            "args": [],
            "cwd": "${workspaceFolder}/PingPong",
            // For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console
            "console": "internalConsole",
            "stopAtEntry": false
        },
        {
            "name": ".NET Core Attach",
            "type": "coreclr",
            "request": "attach",
            "processId": "${command:pickProcess}"
        }
    ]
}

================================================
FILE: samples/SimpleConsoleApp/.vscode/settings.json
================================================
{
    "workbench.colorCustomizations": {
        "activityBar.background": "#1f6fd0",
        "activityBar.foreground": "#e7e7e7",
        "activityBar.inactiveForeground": "#e7e7e799",
        "activityBarBadge.background": "#ee90bb",
        "activityBarBadge.foreground": "#15202b",
        "titleBar.activeBackground": "#1857a4",
        "titleBar.inactiveBackground": "#1857a499",
        "titleBar.activeForeground": "#e7e7e7",
        "titleBar.inactiveForeground": "#e7e7e799",
        "statusBar.background": "#1857a4",
        "statusBarItem.hoverBackground": "#1f6fd0",
        "statusBar.foreground": "#e7e7e7"
    },
    "peacock.color": "#1857a4"
}

================================================
FILE: samples/SimpleConsoleApp/.vscode/tasks.json
================================================
{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "build",
            "command": "dotnet",
            "type": "process",
            "args": [
                "build",
                "${workspaceFolder}/PingPong/PingPong.csproj",
                "/property:GenerateFullPaths=true",
                "/consoleloggerparameters:NoSummary"
            ],
            "problemMatcher": "$msCompile"
        },
        {
            "label": "publish",
            "command": "dotnet",
            "type": "process",
            "args": [
                "publish",
                "${workspaceFolder}/PingPong/PingPong.csproj",
                "/property:GenerateFullPaths=true",
                "/consoleloggerparameters:NoSummary"
            ],
            "problemMatcher": "$msCompile"
        },
        {
            "label": "watch",
            "command": "dotnet",
            "type": "process",
            "args": [
                "watch",
                "run",
                "${workspaceFolder}/PingPong/PingPong.csproj",
                "/property:GenerateFullPaths=true",
                "/consoleloggerparameters:NoSummary"
            ],
            "problemMatcher": "$msCompile"
        }
    ]
}

================================================
FILE: samples/SimpleConsoleApp/PingPong/PingHandler.cs
================================================
using System;
using System.Threading;
using System.Threading.Tasks;

namespace PingPong
{
    public class PingHandler
    {
        public void MyMethod(PingRequest request)
        {
            Console.WriteLine($"{ request.Message } .. Pong ");
        }

        public void MyLongMethod(PingRequest request)
        {
            Console.WriteLine($"{ request.Message } ............... Pong");
        }

        public async Task MyMethodAsync(PingRequest request)
        {
            Console.WriteLine($"{ request.Message } > > > > Pong ");
            await Task.CompletedTask;
        }

        public async Task MyMethodAsync(PingRequest request, CancellationToken cancelationToken)
        {
            Console.WriteLine($"{ request.Message } - - - - - Pong ");
            await Task.CompletedTask;
        }
    }
}

================================================
FILE: samples/SimpleConsoleApp/PingPong/PingPong.csproj
================================================
<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp2.2</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <ProjectReference Include="..\..\..\src\FluentMediator\FluentMediator.csproj" />
    <ProjectReference Include="..\..\..\src\FluentMediator.Microsoft.Extensions.DependencyInjection\FluentMediator.Microsoft.Extensions.DependencyInjection.csproj" />
  </ItemGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="3.0.0" />
  </ItemGroup>

</Project>


================================================
FILE: samples/SimpleConsoleApp/PingPong/PingRequest.cs
================================================
namespace PingPong
{
    public class PingRequest
    {
        public string Message { get; }

        public PingRequest(string message)
        {
            Message = message;
        }
    }
}

================================================
FILE: samples/SimpleConsoleApp/PingPong/Program.cs
================================================
using System;
using System.Threading;
using FluentMediator;
using Microsoft.Extensions.DependencyInjection;

namespace PingPong
{
    class Program
    {
        static void Main(string[] args)
        {
            var serviceCollection = new ServiceCollection();
            serviceCollection.AddFluentMediator(builder =>
            {
                builder.On<PingRequest>().Pipeline()
                    .Call<PingHandler>((handler, req) => handler.MyMethod(req))
                    .Call<PingHandler>((handler, req) => handler.MyLongMethod(req));
                builder.On<PingRequest>().PipelineAsync()
                    .Call<PingHandler>(async(handler, req) => await handler.MyMethodAsync(req));
                builder.On<PingRequest>().CancellablePipelineAsync()
                    .Call<PingHandler>(async(handler, req, ct) => await handler.MyMethodAsync(req, ct));
            });
            serviceCollection.AddScoped<PingHandler>();

            var provider = serviceCollection.BuildServiceProvider();
            var mediator = provider.GetService<IMediator>();

            var ping = new PingRequest("Ping");
            var cts = new CancellationTokenSource();

            Console.WriteLine("Publishing Ping. Should Pong Twice.");

            mediator.Publish(ping);

            Console.WriteLine("Publishing Ping Async. Should Pong One.");

            mediator.PublishAsync(ping)
                .GetAwaiter()
                .GetResult();

            Console.WriteLine("Publishing Cancellable Ping. Should Pong One.");

            mediator.PublishAsync(ping, cts.Token)
                .GetAwaiter()
                .GetResult();

            Console.ReadLine();
        }
    }
}

================================================
FILE: samples/SimpleConsoleApp/Samples.sln
================================================

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26124.0
MinimumVisualStudioVersion = 15.0.26124.0
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PingPong", "PingPong\PingPong.csproj", "{F3A8DBEF-1CE1-4456-9B65-5A37A57B3A4E}"
EndProject
Global
	GlobalSection(SolutionConfigurationPlatforms) = preSolution
		Debug|Any CPU = Debug|Any CPU
		Debug|x64 = Debug|x64
		Debug|x86 = Debug|x86
		Release|Any CPU = Release|Any CPU
		Release|x64 = Release|x64
		Release|x86 = Release|x86
	EndGlobalSection
	GlobalSection(SolutionProperties) = preSolution
		HideSolutionNode = FALSE
	EndGlobalSection
	GlobalSection(ProjectConfigurationPlatforms) = postSolution
		{F3A8DBEF-1CE1-4456-9B65-5A37A57B3A4E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{F3A8DBEF-1CE1-4456-9B65-5A37A57B3A4E}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{F3A8DBEF-1CE1-4456-9B65-5A37A57B3A4E}.Debug|x64.ActiveCfg = Debug|Any CPU
		{F3A8DBEF-1CE1-4456-9B65-5A37A57B3A4E}.Debug|x64.Build.0 = Debug|Any CPU
		{F3A8DBEF-1CE1-4456-9B65-5A37A57B3A4E}.Debug|x86.ActiveCfg = Debug|Any CPU
		{F3A8DBEF-1CE1-4456-9B65-5A37A57B3A4E}.Debug|x86.Build.0 = Debug|Any CPU
		{F3A8DBEF-1CE1-4456-9B65-5A37A57B3A4E}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{F3A8DBEF-1CE1-4456-9B65-5A37A57B3A4E}.Release|Any CPU.Build.0 = Release|Any CPU
		{F3A8DBEF-1CE1-4456-9B65-5A37A57B3A4E}.Release|x64.ActiveCfg = Release|Any CPU
		{F3A8DBEF-1CE1-4456-9B65-5A37A57B3A4E}.Release|x64.Build.0 = Release|Any CPU
		{F3A8DBEF-1CE1-4456-9B65-5A37A57B3A4E}.Release|x86.ActiveCfg = Release|Any CPU
		{F3A8DBEF-1CE1-4456-9B65-5A37A57B3A4E}.Release|x86.Build.0 = Release|Any CPU
	EndGlobalSection
EndGlobal


================================================
FILE: src/FluentMediator/FluentMediator.csproj
================================================
<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>netstandard1.1</TargetFramework>
    <Nullable>enable</Nullable>
    <NullableReferenceTypes>true</NullableReferenceTypes>
    <LangVersion>8.0</LangVersion>
    <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
    <DocumentationFile>bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml</DocumentationFile>
  </PropertyGroup>

	<PropertyGroup>
    <PackageId>FluentMediator</PackageId>
    <Version>0.4.7</Version>
    <Authors>Ivan Paulovich</Authors>
    <Copyright>Ivan Paulovich</Copyright>
    <Description>FluentMediator is an unobtrusive library that allows developers to build custom pipelines for Commands, Queries and Events.</Description>
    <PackageDescription>FluentMediator is an unobtrusive library that allows developers to build custom pipelines for Commands, Queries and Events.</PackageDescription>
    <PackageTags>fluent-design;mediator-pattern;ddd-cqrs;message-bus;event-sourcing;event-driven;chain-of-responsibility;chain-methods;pipelines;dotnet-core;craftmanship;tdd;csharp;pipeline-framework;fluent-interface;event-handlers</PackageTags>
    <IsPackable>true</IsPackable>
    <PackageIcon>icon.png</PackageIcon>
    <RepositoryUrl>https://github.com/ivanpaulovich/FluentMediator</RepositoryUrl>
    <NeutralLanguage>en-US</NeutralLanguage>
	</PropertyGroup>

  <ItemGroup Label="SourceLink">
    <PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" />
  </ItemGroup>

  <PropertyGroup Label="SourceLink">
    <PublishRepositoryUrl>true</PublishRepositoryUrl>
    <IncludeSymbols>true</IncludeSymbols>
    <SymbolPackageFormat>snupkg</SymbolPackageFormat>
  </PropertyGroup>

  <ItemGroup>
    <None Include="../../docs/icon.png">
      <Pack>True</Pack>
      <PackagePath></PackagePath>
    </None>
  </ItemGroup>
</Project>


================================================
FILE: src/FluentMediator/GetService.cs
================================================
using System;

namespace FluentMediator
{
    /// <summary>
    /// Retrieves a Handler Service from the Container
    /// </summary>
    /// <param name="serviceType"></param>
    /// <returns></returns>
    public delegate object GetService(Type serviceType);
}

================================================
FILE: src/FluentMediator/IMediator.cs
================================================
using System;
using FluentMediator.Pipelines.CancellablePipelineAsync;
using FluentMediator.Pipelines.Pipeline;
using FluentMediator.Pipelines.PipelineAsync;

namespace FluentMediator
{
    /// <summary>
    /// Publishes/Sends messages through the Pipelines
    /// </summary>
    public interface IMediator:
        ISyncMediator,
        IAsyncMediator,
        ICancellableMediator
        {
            /// <summary>
            /// On Pipeline Not Found Event Handler.
            /// </summary>
            event EventHandler<PipelineNotFoundEventArgs> ? PipelineNotFound;
        }
}

================================================
FILE: src/FluentMediator/IPipelineProvider.cs
================================================
using FluentMediator.Pipelines.CancellablePipelineAsync;
using FluentMediator.Pipelines.Pipeline;
using FluentMediator.Pipelines.PipelineAsync;

namespace FluentMediator
{
    /// <summary>
    /// Retrieves a Pipeline for a specific Message
    /// </summary>
    public interface IPipelineProvider:
        ISyncPipelineProvider,
        IAsyncPipelineProvider,
        ICancellablePipelineProvider { }
}

================================================
FILE: src/FluentMediator/IPipelineProviderBuilder.cs
================================================
using FluentMediator.Pipelines;
using FluentMediator.Pipelines.CancellablePipelineAsync;
using FluentMediator.Pipelines.Pipeline;
using FluentMediator.Pipelines.PipelineAsync;

namespace FluentMediator
{
    /// <summary>
    /// Builds pipelines for a specific message
    /// </summary>
    public interface IPipelineProviderBuilder:
        ISyncPipelineProviderBuilder,
        IAsyncPipelineProviderBuilder,
        ICancellablePipelineProviderBuilder
        {
            /// <summary>
            /// Begin building a pipeline for a specific message
            /// </summary>
            /// <typeparam name="TRequest">Message Type</typeparam>
            /// <returns>A more specific PipelineBehavior</returns>
            IPipelineBehavior<TRequest> On<TRequest>();

            /// <summary>
            /// Builds the pipeline
            /// </summary>
            /// <returns>An immutable Pipeline Provider</returns>
            IPipelineProvider Build();
        }
}

================================================
FILE: src/FluentMediator/Mediator.cs
================================================
using System;
using System.Threading;
using System.Threading.Tasks;
using FluentMediator.Pipelines;

namespace FluentMediator
{
    /// <summary>
    /// Publishes/Sends messages through the Pipelines
    /// </summary>
    public class Mediator : IMediator
    {
        /// <summary>
        /// Returns a service from the Container
        /// </summary>
        /// <value></value>
        public GetService GetService { get; }

        private IPipelineProvider _pipelines;

        /// <summary>
        /// On Pipeline Not Found Handler.
        /// </summary>
        public event EventHandler<PipelineNotFoundEventArgs> ? PipelineNotFound;

        /// <summary>
        /// Instantiate a Mediator
        /// </summary>
        /// <param name="getService">Service Provider</param>
        /// <param name="pipelines">Pipeline Provider</param>
        public Mediator(
            GetService getService,
            IPipelineProvider pipelines)
        {
            GetService = getService;
            _pipelines = pipelines;
        }

        /// <summary>
        /// Publishes messages through the Pipeline
        /// </summary>
        /// <param name="request">Message</param>
        /// <param name="pipelineName">An optional pipeline name</param>
        public void Publish(object request, string? pipelineName = null)
        {
            if (request is null)
            {
                throw new NullRequestException("The request is null.");
            }

            try
            {
                if (pipelineName is string)
                {
                    var pipeline = _pipelines.GetPipeline(pipelineName);
                    pipeline.Publish(GetService, request!);
                }
                else
                {
                    var pipeline = _pipelines.GetPipeline(request.GetType());
                    pipeline.Publish(GetService, request!);
                }
            }
            catch (PipelineNotFoundException)
            {
                var e = new PipelineNotFoundEventArgs(request);
                OnPipelineNotFound(e);
            }
        }

        /// <summary>
        /// Publishes messages through the Pipeline
        /// </summary>
        /// <param name="request">Message</param>
        /// <param name="pipelineName">An optional pipeline name</param>
        /// <typeparam name="TResult">The desired Typed result</typeparam>
        /// <returns>The result object</returns>
        public TResult Send<TResult>(object request, string? pipelineName = null)
        {
            if (request is null)
            {
                throw new NullRequestException("The request is null.");
            }

            if (pipelineName is string)
            {
                var pipeline = _pipelines.GetPipeline(pipelineName);
                return pipeline.Send<TResult>(GetService, request);
            }
            else
            {
                var pipeline = _pipelines.GetPipeline(request.GetType());
                return pipeline.Send<TResult>(GetService, request);
            }
        }

        /// <summary>
        /// Publishes messages through the Pipeline
        /// </summary>
        /// <param name="request">Message</param>
        /// <param name="pipelineName">An optional pipeline name</param>
        /// <returns>Task object</returns>
        public async Task PublishAsync(object request, string? pipelineName = null)
        {
            if (request is null)
            {
                throw new NullRequestException("The request is null.");
            }

            if (pipelineName is string)
            {
                var pipeline = _pipelines.GetAsyncPipeline(pipelineName);
                await pipeline.PublishAsync(GetService, request);
            }
            else
            {
                var pipeline = _pipelines.GetAsyncPipeline(request.GetType());
                await pipeline.PublishAsync(GetService, request);
            }
        }

        /// <summary>
        /// Publishes messages through the Pipeline
        /// </summary>
        /// <param name="request">Message</param>
        /// <param name="pipelineName">An optional pipeline name</param>
        /// <typeparam name="TResult">The desired Typed result</typeparam>
        /// <returns>The result object</returns>
        public async Task<TResult> SendAsync<TResult>(object request, string? pipelineName = null)
        {
            if (request is null)
            {
                throw new NullRequestException("The request is null.");
            }

            if (pipelineName is string)
            {
                var pipeline = _pipelines.GetAsyncPipeline(pipelineName);
                return await pipeline.SendAsync<TResult>(GetService, request);
            }
            else
            {
                var pipeline = _pipelines.GetAsyncPipeline(request.GetType());
                return await pipeline.SendAsync<TResult>(GetService, request);
            }
        }

        /// <summary>
        /// Publishes messages through the Pipeline
        /// </summary>
        /// <param name="request">Message</param>
        /// <param name="cancellationToken">Cancellation Token to gracefully exit in middle of execution</param>
        /// <param name="pipelineName">Optional Pipeline Name</param>
        /// <returns>Task object</returns>
        public async Task PublishAsync(object request, CancellationToken cancellationToken, string? pipelineName = null)
        {
            if (request is null)
            {
                throw new NullRequestException("The request is null.");
            }

            if (pipelineName is string)
            {
                var pipeline = _pipelines.GetCancellablePipeline(pipelineName);
                await pipeline.PublishAsync(GetService, request, cancellationToken);
            }
            else
            {
                var pipeline = _pipelines.GetCancellablePipeline(request.GetType());
                await pipeline.PublishAsync(GetService, request, cancellationToken);
            }
        }

        /// <summary>
        /// Sends messages through the Pipeline
        /// </summary>
        /// <param name="request">Message</param>
        /// <param name="cancellationToken">Cancellation Token to gracefully exit in middle of execution</param>
        /// <param name="pipelineName">Optional Pipeline Name</param>
        /// <typeparam name="TResult">Result Type</typeparam>
        /// <returns>Result object</returns>
        public async Task<TResult> SendAsync<TResult>(object request, CancellationToken cancellationToken, string? pipelineName = null)
        {
            if (request is null)
            {
                throw new NullRequestException("The request is null.");
            }

            if (pipelineName is string)
            {
                var pipeline = _pipelines.GetCancellablePipeline(pipelineName);
                return await pipeline.SendAsync<TResult>(GetService, request, cancellationToken);
            }
            else
            {
                var pipeline = _pipelines.GetCancellablePipeline(request.GetType());
                return await pipeline.SendAsync<TResult>(GetService, request, cancellationToken);
            }
        }

        /// <summary>
        /// On Pipeline Not Found.
        /// </summary>
        /// <param name="e">OnErrorEventArgs.</param>
        protected virtual void OnPipelineNotFound(PipelineNotFoundEventArgs e)
        {
            if (this.PipelineNotFound is EventHandler<PipelineNotFoundEventArgs>)
            {
                this.PipelineNotFound(this, e);
            }
        }
    }
}

================================================
FILE: src/FluentMediator/MediatorException.cs
================================================
using System;

namespace FluentMediator
{
    /// <summary>
    /// All Exceptions from FluentMediator are derived from MediatorException
    /// </summary>
    public class MediatorException : Exception
    {
        /// <summary>
        /// Instantiate a MediatorException
        /// </summary>
        /// <param name="message">Error message</param>
        /// <returns>The exception</returns>
        public MediatorException(string message) : base(message) { }
    }
}

================================================
FILE: src/FluentMediator/NullRequestException.cs
================================================
namespace FluentMediator
{
    /// <summary>
    /// Occurs when the message is null
    /// </summary>
    public class NullRequestException : MediatorException
    {
        /// <summary>
        /// Instantiate an Exception
        /// </summary>
        /// <param name="message">The message</param>
        /// <returns>An Exception instance</returns>
        public NullRequestException(string message) : base(message) { }
    }
}

================================================
FILE: src/FluentMediator/PipelineNotFoundEventArgs.cs
================================================
using System;

namespace FluentMediator
{
    /// <summary>
    /// On Error Event.
    /// </summary>
    public class PipelineNotFoundEventArgs : EventArgs
    {
        /// <summary>
        /// 
        /// </summary>
        /// <value></value>
        public object Message { get; }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="message"></param>
        public PipelineNotFoundEventArgs(object message)
        {
            this.Message = message;
        }
    }
}

================================================
FILE: src/FluentMediator/PipelineProvider.cs
================================================
using System;
using FluentMediator.Pipelines;
using FluentMediator.Pipelines.CancellablePipelineAsync;
using FluentMediator.Pipelines.Pipeline;
using FluentMediator.Pipelines.PipelineAsync;

namespace FluentMediator
{
    /// <summary>
    /// Retrieves Pipelines for a message
    /// </summary>
    internal sealed class PipelineProvider : IPipelineProvider
    {
        private readonly IPipelineCollection<IPipeline> _pipelineCollection;
        private readonly IPipelineCollection<IPipelineAsync> _asyncPipelineCollection;
        private readonly IPipelineCollection<ICancellablePipelineAsync> _cancellablePipelineCollection;

        /// <summary>
        /// Instantiate a PipelineProvider
        /// </summary>
        /// <param name="pipelineCollection">Sync Pipelines</param>
        /// <param name="asyncPipelineCollection">Async Pipelines</param>
        /// <param name="cancellablePipelineCollection">Cancellable Pipelines</param>
        public PipelineProvider(
            IPipelineCollection<IPipeline> pipelineCollection,
            IPipelineCollection<IPipelineAsync> asyncPipelineCollection,
            IPipelineCollection<ICancellablePipelineAsync> cancellablePipelineCollection)
        {
            _pipelineCollection = pipelineCollection;
            _asyncPipelineCollection = asyncPipelineCollection;
            _cancellablePipelineCollection = cancellablePipelineCollection;
        }

        /// <summary>
        /// Gets an async pipeline
        /// </summary>
        /// <param name="requestType">Message Type</param>
        /// <returns>Pipeline</returns>
        public IPipelineAsync GetAsyncPipeline(Type requestType)
        {
            return _asyncPipelineCollection.Get(requestType);
        }

        /// <summary>
        /// Gets an async pipeline
        /// </summary>
        /// <param name="pipelineName">Pipeline Name</param>
        /// <returns>Pipeline</returns>
        public IPipelineAsync GetAsyncPipeline(string pipelineName)
        {
            return _asyncPipelineCollection.Get(pipelineName);
        }

        /// <summary>
        /// Gets a cancellable pipeline
        /// </summary>
        /// <param name="requestType">Request Type</param>
        /// <returns>Pipeline</returns>
        public ICancellablePipelineAsync GetCancellablePipeline(Type requestType)
        {
            return _cancellablePipelineCollection.Get(requestType);
        }

        /// <summary>
        /// Gets a cancellable pipeline
        /// </summary>
        /// <param name="pipelineName">Pipeline Name</param>
        /// <returns>Pipeline</returns>
        public ICancellablePipelineAsync GetCancellablePipeline(string pipelineName)
        {
            return _cancellablePipelineCollection.Get(pipelineName);
        }

        /// <summary>
        /// Gets a Pipeline
        /// </summary>
        /// <param name="requestType">Request Type</param>
        /// <returns>Pipeline</returns>
        public IPipeline GetPipeline(Type requestType)
        {
            return _pipelineCollection.Get(requestType);
        }

        /// <summary>
        /// Gets a Pipeline
        /// </summary>
        /// <param name="pipelineName">Pipeline Name</param>
        /// <returns>Pipeline</returns>
        public IPipeline GetPipeline(string pipelineName)
        {
            return _pipelineCollection.Get(pipelineName);
        }
    }
}

================================================
FILE: src/FluentMediator/PipelineProviderBuilder.cs
================================================
using System.Collections.Generic;
using System.Collections.ObjectModel;
using FluentMediator.Pipelines;
using FluentMediator.Pipelines.CancellablePipelineAsync;
using FluentMediator.Pipelines.Pipeline;
using FluentMediator.Pipelines.PipelineAsync;

namespace FluentMediator
{
    /// <summary>
    /// PipelineProvider Builder
    /// </summary>
    public class PipelineProviderBuilder : IPipelineProviderBuilder
    {
        private ICollection<IPipelineBuilder> _pipelineBuilderCollection { get; }
        private ICollection<IPipelineAsyncBuilder> _asyncPipelineBuilderCollection { get; }
        private ICollection<ICancellablePipelineAsyncBuilder> _cancellablePipelineBuilderCollection { get; }

        /// <summary>
        /// Instantiate a PipelineProviderBuilder
        /// </summary>
        public PipelineProviderBuilder()
        {
            _pipelineBuilderCollection = new Collection<IPipelineBuilder>();
            _asyncPipelineBuilderCollection = new Collection<IPipelineAsyncBuilder>();
            _cancellablePipelineBuilderCollection = new Collection<ICancellablePipelineAsyncBuilder>();
        }

        /// <summary>
        /// Returns a PipelineBehavior for a Message Type
        /// </summary>
        /// <typeparam name="TRequest">MessageType</typeparam>
        /// <returns>PipelineBehavior</returns>
        public IPipelineBehavior<TRequest> On<TRequest>()
        {
            var behavior = new PipelineBehavior<TRequest>(this);
            return behavior;
        }

        /// <summary>
        /// Adds a Pipeline
        /// </summary>
        /// <param name="pipelineBuilder">PipelineBuilder</param>
        /// <returns>PipelineBuilder</returns>
        public IPipelineBuilder Add(IPipelineBuilder pipelineBuilder)
        {
            _pipelineBuilderCollection.Add(pipelineBuilder);
            return pipelineBuilder;
        }

        /// <summary>
        /// Adds a Pipeline
        /// </summary>
        /// <param name="pipelineBuilder">PipelineBuilder</param>
        /// <returns>PipelineBuilder</returns>
        public IPipelineAsyncBuilder Add(IPipelineAsyncBuilder pipelineBuilder)
        {
            _asyncPipelineBuilderCollection.Add(pipelineBuilder);
            return pipelineBuilder;
        }

        /// <summary>
        /// Adds a Pipeline
        /// </summary>
        /// <param name="pipelineBuilder">PipelineBuilder</param>
        /// <returns>PipelineBuilder</returns>
        public ICancellablePipelineAsyncBuilder Add(ICancellablePipelineAsyncBuilder pipelineBuilder)
        {
            _cancellablePipelineBuilderCollection.Add(pipelineBuilder);
            return pipelineBuilder;
        }

        /// <summary>
        /// Builds a PipelineProvider
        /// </summary>
        /// <returns>Returns a immutable PipelineProvider</returns>
        public IPipelineProvider Build()
        {
            var pipelineCollection = new PipelineCollection<IPipeline>();
            var asyncPipelineCollection = new PipelineCollection<IPipelineAsync>();
            var cancellablePipelineCollection = new PipelineCollection<ICancellablePipelineAsync>();

            foreach (var item in _pipelineBuilderCollection)
            {
                var pipeline = item.Build();
                pipelineCollection.Add(pipeline);
            }

            foreach (var item in _asyncPipelineBuilderCollection)
            {
                var pipeline = item.Build();
                asyncPipelineCollection.Add(pipeline);
            }

            foreach (var item in _cancellablePipelineBuilderCollection)
            {
                var pipeline = item.Build();
                cancellablePipelineCollection.Add(pipeline);
            }

            return new PipelineProvider(
                pipelineCollection,
                asyncPipelineCollection,
                cancellablePipelineCollection
            );
        }
    }
}

================================================
FILE: src/FluentMediator/Pipelines/CancellablePipelineAsync/Direct.cs
================================================
using System;
using System.Threading;
using System.Threading.Tasks;

namespace FluentMediator.Pipelines.CancellablePipelineAsync
{
    internal sealed class Direct<TRequest, TResult, THandler> : IDirect
    {
        private readonly Method<Func<object, object, CancellationToken, Task<TResult>>> _method;

        public Direct(Func<THandler, TRequest, CancellationToken, Task<TResult>> action)
        {
            Func<object, object, CancellationToken, Task<TResult>> typedHandler = (h, req, ct) => action((THandler) h, (TRequest) req, ct);
            _method = new Method<Func<object, object, CancellationToken, Task<TResult>>>(typeof(THandler), typedHandler);
        }

        public async Task<TResponse> SendAsync<TResponse>(GetService getService, object request, CancellationToken cancellationToken)
        {
            var concreteHandler = getService(typeof(THandler));
            Func<THandler, TRequest, CancellationToken, Task<TResponse>> typedHandler = (h, req, ct) => (Task<TResponse>) (object) _method.Action((THandler) concreteHandler, (TRequest) (object) request!, ct);
            return await typedHandler((THandler) concreteHandler, (TRequest) (object) request!, cancellationToken);
        }
    }
}

================================================
FILE: src/FluentMediator/Pipelines/CancellablePipelineAsync/ICancellableMediator.cs
================================================
using System.Threading;
using System.Threading.Tasks;

namespace FluentMediator.Pipelines.CancellablePipelineAsync
{
    /// <summary>
    /// Cancellable Mediator
    /// </summary>
    public interface ICancellableMediator
    {
        /// <summary>
        /// Publishes a message
        /// </summary>
        /// <param name="request">A message</param>
        /// <param name="cancellationToken">Cancellation Token</param>
        /// <param name="pipelineName">Pipeline Name</param>
        /// <returns>Task object</returns>
        Task PublishAsync(object request, CancellationToken cancellationToken, string? pipelineName = null);

        /// <summary>
        /// Sends a message
        /// </summary>
        /// <param name="request">A message</param>
        /// <param name="cancellationToken">Cancellation Token</param>
        /// <param name="pipelineName">Pipeline Name</param>
        /// <typeparam name="TResult">Result Type</typeparam>
        /// <returns></returns>
        Task<TResult> SendAsync<TResult>(object request, CancellationToken cancellationToken, string? pipelineName = null);
    }
}

================================================
FILE: src/FluentMediator/Pipelines/CancellablePipelineAsync/ICancellablePipelineAsync.cs
================================================
using System.Threading;
using System.Threading.Tasks;

namespace FluentMediator.Pipelines.CancellablePipelineAsync
{
    /// <summary>
    /// Cancellable Pipeline
    /// </summary>
    public interface ICancellablePipelineAsync : INamedPipeline, ITypedPipeline
    {
        /// <summary>
        /// Publishes a message
        /// </summary>
        /// <param name="getService">Retriever a service from the container</param>
        /// <param name="request">Request message</param>
        /// <param name="cancellationToken">Cancellation Token</param>
        /// <returns>Task object</returns>
        Task PublishAsync(GetService getService, object request, CancellationToken cancellationToken);

        /// <summary>
        /// Sends a message
        /// </summary>
        /// <param name="getService">Retriever a service from the container</param>
        /// <param name="request">Request message</param>
        /// <param name="cancellationToken">Cancellation Token</param>
        /// <typeparam name="TResult">Message type</typeparam>
        /// <returns>Response message</returns>
        Task<TResult> SendAsync<TResult>(GetService getService, object request, CancellationToken cancellationToken);
    }
}

================================================
FILE: src/FluentMediator/Pipelines/CancellablePipelineAsync/ICancellablePipelineAsyncBuilder.cs
================================================
using System;
using System.Threading;
using System.Threading.Tasks;

namespace FluentMediator.Pipelines.CancellablePipelineAsync
{
    /// <summary>
    /// Cancellable Pipeline
    /// </summary>
    /// <typeparam name="TRequest"></typeparam>
    public interface ICancellablePipelineAsyncBuilder<TRequest> : ICancellablePipelineAsyncBuilder
    {
        /// <summary>
        /// 
        /// </summary>
        /// <param name="func"></param>
        /// <typeparam name="THandler"></typeparam>
        /// <returns></returns>
        ICancellablePipelineAsyncBuilder<TRequest> Call<THandler>(Func<THandler, TRequest, CancellationToken, Task> func);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="func"></param>
        /// <typeparam name="TResult"></typeparam>
        /// <typeparam name="THandler"></typeparam>
        /// <returns></returns>
        ICancellablePipelineAsync Return<TResult, THandler>(Func<THandler, TRequest, CancellationToken, Task<TResult>> func);
    }

    /// <summary>
    /// 
    /// </summary>
    public interface ICancellablePipelineAsyncBuilder
    {
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        ICancellablePipelineAsync Build();
    }
}

================================================
FILE: src/FluentMediator/Pipelines/CancellablePipelineAsync/ICancellablePipelineProvider.cs
================================================
using System;

namespace FluentMediator.Pipelines.CancellablePipelineAsync
{
    /// <summary>
    /// 
    /// </summary>
    public interface ICancellablePipelineProvider
    {
        /// <summary>
        /// 
        /// </summary>
        /// <param name="requestType"></param>
        /// <returns></returns>
        ICancellablePipelineAsync GetCancellablePipeline(Type requestType);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="pipelineName"></param>
        /// <returns></returns>
        ICancellablePipelineAsync GetCancellablePipeline(string pipelineName);
    }
}

================================================
FILE: src/FluentMediator/Pipelines/CancellablePipelineAsync/ICancellablePipelineProviderBuilder.cs
================================================
namespace FluentMediator.Pipelines.CancellablePipelineAsync
{
    /// <summary>
    /// 
    /// </summary>
    public interface ICancellablePipelineProviderBuilder
    {
        /// <summary>
        /// 
        /// </summary>
        /// <param name="pipelineBuilder"></param>
        /// <returns></returns>
        ICancellablePipelineAsyncBuilder Add(ICancellablePipelineAsyncBuilder pipelineBuilder);
    }
}

================================================
FILE: src/FluentMediator/Pipelines/CancellablePipelineAsync/IDirect.cs
================================================
using System.Threading;
using System.Threading.Tasks;

namespace FluentMediator.Pipelines.CancellablePipelineAsync
{
    internal interface IDirect
    {
        Task<TResult> SendAsync<TResult>(
            GetService getService,
            object request,
            CancellationToken cancellationToken
        );
    }
}

================================================
FILE: src/FluentMediator/Pipelines/CancellablePipelineAsync/Pipeline.cs
================================================
using System;
using System.Threading;
using System.Threading.Tasks;

namespace FluentMediator.Pipelines.CancellablePipelineAsync
{
    internal sealed class Pipeline : ICancellablePipelineAsync
    {
        private readonly IMethodCollection<Method<Func<object, object, CancellationToken, Task>>> _methods;
        private readonly IDirect? _direct;

        public Pipeline(IMethodCollection<Method<Func<object, object, CancellationToken, Task>>> methods,
            IDirect? direct,
            Type requestType,
            string? name)
        {
            _methods = methods;
            _direct = direct;
            RequestType = requestType;
            Name = name;
        }

        public Type RequestType { get; }
        public string? Name { get; }

        public async Task PublishAsync(GetService getService, object request, CancellationToken cancellationToken)
        {
            foreach (var handler in _methods.GetMethods())
            {
                cancellationToken.ThrowIfCancellationRequested();

                var concreteHandler = getService(handler.HandlerType);
                await handler.Action(concreteHandler, request, cancellationToken);
            }
        }

        public async Task<TResult> SendAsync<TResult>(GetService getService, object request, CancellationToken cancellationToken)
        {
            if (_direct is null)
            {
                throw new ReturnFunctionIsNullException("The return function is null. SendAsync<TResult> method not executed.");
            }

            foreach (var handler in _methods.GetMethods())
            {
                cancellationToken.ThrowIfCancellationRequested();

                var concreteHandler = getService(handler.HandlerType);
                await handler.Action(concreteHandler, request, cancellationToken);
            }

            cancellationToken.ThrowIfCancellationRequested();

            return await _direct.SendAsync<TResult>(getService, request!, cancellationToken) !;
        }
    }
}

================================================
FILE: src/FluentMediator/Pipelines/CancellablePipelineAsync/PipelineBuilder.cs
================================================
using System;
using System.Threading;
using System.Threading.Tasks;

namespace FluentMediator.Pipelines.CancellablePipelineAsync
{
    internal class PipelineBuilder<TRequest> : ICancellablePipelineAsyncBuilder<TRequest>
    {
        private readonly IMethodCollection<Method<Func<object, object, CancellationToken, Task>>> _methods;
        private IDirect? _direct;
        private string? _name;

        public PipelineBuilder(string? name)
        {
            _methods = new MethodCollection<Method<Func<object, object, CancellationToken, Task>>>();
            _name = name;
        }

        public ICancellablePipelineAsyncBuilder<TRequest> Call<THandler>(Func<THandler, TRequest, CancellationToken, Task> func)
        {
            Func<object, object, CancellationToken, Task> typedHandler = async(h, r, c) => await func((THandler) h, (TRequest) r, c);
            var method = new Method<Func<object, object, CancellationToken, Task>>(typeof(THandler), typedHandler);
            _methods.Add(method);
            return this;
        }

        public ICancellablePipelineAsync Return<TResult, THandler>(Func<THandler, TRequest, CancellationToken, Task<TResult>> func)
        {
            _direct = new Direct<TRequest, TResult, THandler>(func);
            return Build();
        }

        public ICancellablePipelineAsync Build()
        {
            return new Pipeline(_methods, _direct, typeof(TRequest), _name);
        }
    }
}

================================================
FILE: src/FluentMediator/Pipelines/IMethodCollection.cs
================================================
using System.Collections.ObjectModel;

namespace FluentMediator.Pipelines
{
    internal interface IMethodCollection<Method>
    {
        ReadOnlyCollection<Method> GetMethods();
        void Add(Method method);
    }
}

================================================
FILE: src/FluentMediator/Pipelines/INamedPipeline.cs
================================================
namespace FluentMediator.Pipelines
{
    /// <summary>
    /// Named Pipeline
    /// </summary>
    public interface INamedPipeline
    {
        /// <summary>
        /// An unique pipeline name
        /// </summary>
        /// <value>null</value>
        string? Name { get; }
    }
}

================================================
FILE: src/FluentMediator/Pipelines/IPipelineBehavior.cs
================================================
using FluentMediator.Pipelines.CancellablePipelineAsync;
using FluentMediator.Pipelines.Pipeline;
using FluentMediator.Pipelines.PipelineAsync;

namespace FluentMediator.Pipelines
{
    /// <summary>
    /// PipelineBehavior
    /// </summary>
    /// <typeparam name="TRequest"></typeparam>
    public interface IPipelineBehavior<TRequest>
    {
        /// <summary>
        /// Creates a IPipelineBuilder
        /// </summary>
        /// <param name="pipelineName">An unique name or null</param>
        /// <returns>IPipelineBuilder</returns>
        IPipelineBuilder<TRequest> Pipeline(string? pipelineName = null);

        /// <summary>
        /// Creates an IPipelineAsyncBuilder
        /// </summary>
        /// <param name="pipelineName">An unique name or null</param>
        /// <returns>IPipelineAsyncBuilder</returns>
        IPipelineAsyncBuilder<TRequest> PipelineAsync(string? pipelineName = null);

        /// <summary>
        /// Creates an ICancellablePipelineAsyncBuilder
        /// </summary>
        /// <param name="pipelineName">An unique name or null</param>
        /// <returns>ICancellablePipelineAsyncBuilder</returns>
        ICancellablePipelineAsyncBuilder<TRequest> CancellablePipelineAsync(string? pipelineName = null);
    }
}

================================================
FILE: src/FluentMediator/Pipelines/IPipelineCollection.cs
================================================
using System;

namespace FluentMediator.Pipelines
{
    internal interface IPipelineCollection<TPipeline> where TPipeline : class, ITypedPipeline
    {
        void Add(TPipeline pipeline);
        TPipeline Get(Type requestType);
        TPipeline Get(string pipelineName);
    }
}

================================================
FILE: src/FluentMediator/Pipelines/ITypedPipeline.cs
================================================
using System;

namespace FluentMediator.Pipelines
{
    /// <summary>
    /// A Typed Pipeline
    /// </summary>
    public interface ITypedPipeline
    {
        /// <summary>
        /// A RequestType
        /// </summary>
        /// <value></value>
        Type RequestType { get; }
    }
}

================================================
FILE: src/FluentMediator/Pipelines/Method.cs
================================================
using System;

namespace FluentMediator.Pipelines
{
    internal sealed class Method<TAction>
    {
        public Type HandlerType { get; }
        public TAction Action { get; }

        public Method(Type handlerType, TAction action)
        {
            HandlerType = handlerType;
            Action = action;
        }
    }
}

================================================
FILE: src/FluentMediator/Pipelines/MethodCollection.cs
================================================
using System.Collections.Generic;
using System.Collections.ObjectModel;

namespace FluentMediator.Pipelines
{
    internal sealed class MethodCollection<Method> : IMethodCollection<Method>
    {
        private readonly IList<Method> _asyncMethods;

        public MethodCollection()
        {
            _asyncMethods = new List<Method>();
        }

        public ReadOnlyCollection<Method> GetMethods()
        {
            return new ReadOnlyCollection<Method>(_asyncMethods);
        }

        public void Add(Method method)
        {
            _asyncMethods.Add(method);
        }
    }
}

================================================
FILE: src/FluentMediator/Pipelines/Pipeline/Direct.cs
================================================
using System;

namespace FluentMediator.Pipelines.Pipeline
{
    internal sealed class Direct<TRequest, TResult, THandler> : IDirect
    {
        private readonly Method<Func<object, object, TResult>> _method;

        public Direct(Func<THandler, TRequest, TResult> action)
        {
            Func<object, object, TResult> typedHandler = (h, req) => action((THandler) h, (TRequest) req);
            _method = new Method<Func<object, object, TResult>>(typeof(THandler), typedHandler);
        }

        public TResponse Send<TResponse>(GetService getService, object request)
        {
            var concreteHandler = getService(_method.HandlerType);
            return (TResponse) (object) _method.Action((THandler) concreteHandler, (TRequest) request) !;
        }
    }
}

================================================
FILE: src/FluentMediator/Pipelines/Pipeline/IDirect.cs
================================================
namespace FluentMediator.Pipelines.Pipeline
{
    internal interface IDirect
    {
        TResult Send<TResult>(
            GetService getService,
            object request
        );
    }
}

================================================
FILE: src/FluentMediator/Pipelines/Pipeline/IPipeline.cs
================================================
namespace FluentMediator.Pipelines.Pipeline
{
    /// <summary>
    /// 
    /// </summary>
    public interface IPipeline : INamedPipeline, ITypedPipeline
    {
        /// <summary>
        /// 
        /// </summary>
        /// <param name="getService"></param>
        /// <param name="request"></param>
        void Publish(GetService getService, object request);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="getService"></param>
        /// <param name="request"></param>
        /// <typeparam name="TResult"></typeparam>
        /// <returns></returns>
        TResult Send<TResult>(GetService getService, object request);
    }
}

================================================
FILE: src/FluentMediator/Pipelines/Pipeline/IPipelineBuilder.cs
================================================
using System;

namespace FluentMediator.Pipelines.Pipeline
{
    /// <summary>
    /// 
    /// </summary>
    /// <typeparam name="TRequest"></typeparam>
    public interface IPipelineBuilder<TRequest> : IPipelineBuilder
    {
        /// <summary>
        /// 
        /// </summary>
        /// <param name="action"></param>
        /// <typeparam name="THandler"></typeparam>
        /// <returns></returns>
        IPipelineBuilder<TRequest> Call<THandler>(Action<THandler, TRequest> action);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="func"></param>
        /// <typeparam name="TResult"></typeparam>
        /// <typeparam name="THandler"></typeparam>
        /// <returns></returns>
        IPipeline Return<TResult, THandler>(Func<THandler, TRequest, TResult> func);
    }

    /// <summary>
    /// 
    /// </summary>
    public interface IPipelineBuilder
    {
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        IPipeline Build();
    }
}

================================================
FILE: src/FluentMediator/Pipelines/Pipeline/ISyncMediator.cs
================================================
namespace FluentMediator.Pipelines.Pipeline
{
    /// <summary>
    /// 
    /// </summary>
    public interface ISyncMediator
    {
        /// <summary>
        /// 
        /// </summary>
        /// <param name="request"></param>
        /// <param name="pipelineName"></param>
        void Publish(object request, string? pipelineName = null);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="request"></param>
        /// <param name="pipelineName"></param>
        /// <typeparam name="TResult"></typeparam>
        /// <returns></returns>
        TResult Send<TResult>(object request, string? pipelineName = null);
    }
}

================================================
FILE: src/FluentMediator/Pipelines/Pipeline/ISyncPipelineProvider.cs
================================================
using System;

namespace FluentMediator.Pipelines.Pipeline
{
    /// <summary>
    /// 
    /// </summary>
    public interface ISyncPipelineProvider
    {
        /// <summary>
        /// 
        /// </summary>
        /// <param name="requestType"></param>
        /// <returns></returns>
        IPipeline GetPipeline(Type requestType);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="pipelineName"></param>
        /// <returns></returns>
        IPipeline GetPipeline(string pipelineName);
    }
}

================================================
FILE: src/FluentMediator/Pipelines/Pipeline/ISyncPipelineProviderBuilder.cs
================================================
namespace FluentMediator.Pipelines.Pipeline
{
    /// <summary>
    /// 
    /// </summary>
    public interface ISyncPipelineProviderBuilder
    {
        /// <summary>
        /// 
        /// </summary>
        /// <param name="pipelineBuilder"></param>
        /// <returns></returns>
        IPipelineBuilder Add(IPipelineBuilder pipelineBuilder);
    }
}

================================================
FILE: src/FluentMediator/Pipelines/Pipeline/Pipeline.cs
================================================
using System;

namespace FluentMediator.Pipelines.Pipeline
{
    internal sealed class Pipeline : IPipeline
    {
        private readonly IMethodCollection<Method<Action<object, object>>> _methods;
        private readonly IDirect? _direct;

        public Pipeline(IMethodCollection<Method<Action<object, object>>> methods, IDirect? direct, Type requestType, string? name)
        {
            _methods = methods;
            _direct = direct;
            RequestType = requestType;
            Name = name;
        }

        public Type RequestType { get; }
        public string? Name { get; }

        public void Publish(GetService getService, object request)
        {
            foreach (var handler in _methods.GetMethods())
            {
                var concreteHandler = getService(handler.HandlerType);
                handler.Action(concreteHandler, request);
            }
        }

        public TResult Send<TResult>(GetService getService, object request)
        {
            if (_direct is null)
            {
                throw new ReturnFunctionIsNullException("The return function is null. Send<TResult> method not executed.");
            }

            foreach (var handler in _methods.GetMethods())
            {
                var concreteHandler = getService(handler.HandlerType);
                handler.Action(concreteHandler, request);
            }

            return _direct.Send<TResult>(getService, request!) !;
        }
    }
}

================================================
FILE: src/FluentMediator/Pipelines/Pipeline/PipelineBuilder.cs
================================================
using System;

namespace FluentMediator.Pipelines.Pipeline
{
    internal sealed class PipelineBuilder<TRequest> : IPipelineBuilder<TRequest>
    {
        private readonly IMethodCollection<Method<Action<object, object>>> _methods;
        private IDirect? _direct;
        private string? _name;

        public PipelineBuilder(string? name)
        {
            _methods = new MethodCollection<Method<Action<object, object>>>();
            _name = name;
        }

        public IPipelineBuilder<TRequest> Call<THandler>(Action<THandler, TRequest> action)
        {
            Action<object, object> typedHandler = (h, r) => action((THandler) h, (TRequest) r);
            var method = new Method<Action<object, object>>(typeof(THandler), typedHandler);
            _methods.Add(method);
            return this;
        }

        public IPipeline Return<TResult, THandler>(Func<THandler, TRequest, TResult> func)
        {
            _direct = new Direct<TRequest, TResult, THandler>(func);
            return Build();
        }

        public IPipeline Build()
        {
            return new Pipeline(_methods, _direct, typeof(TRequest), _name);
        }
    }
}

================================================
FILE: src/FluentMediator/Pipelines/PipelineAlreadyExistsException.cs
================================================
namespace FluentMediator.Pipelines
{
    /// <summary>
    /// Occurs when pipelines have the same name
    /// </summary>
    public sealed class PipelineAlreadyExistsException : MediatorException
    {
        /// <summary>
        /// Instantiate an PipelineAlreadyExistsException
        /// </summary>
        /// <param name="message">Message</param>
        /// <returns>PipelineAlreadyExistsException</returns>
        public PipelineAlreadyExistsException(string message) : base(message) { }
    }
}

================================================
FILE: src/FluentMediator/Pipelines/PipelineAsync/Direct.cs
================================================
using System;
using System.Threading.Tasks;

namespace FluentMediator.Pipelines.PipelineAsync
{
    internal sealed class Direct<TRequest, TResult, THandler> : IDirect
    {
        private readonly Method<Func<object, object, Task<TResult>>> _method;

        public Direct(Func<THandler, TRequest, Task<TResult>> action)
        {
            Func<object, object, Task<TResult>> typedHandler = (h, req) => action((THandler) h, (TRequest) req);
            _method = new Method<Func<object, object, Task<TResult>>>(typeof(THandler), typedHandler);
        }

        public async Task<TResponse> SendAsync<TResponse>(GetService getService, object request)
        {
            var concreteHandler = getService(typeof(THandler));
            Func<THandler, TRequest, Task<TResponse>> typedHandler = (h, req) => (Task<TResponse>) (object) _method.Action((THandler) concreteHandler, (TRequest) (object) request!);
            return await typedHandler((THandler) concreteHandler, (TRequest) (object) request!);
        }
    }
}

================================================
FILE: src/FluentMediator/Pipelines/PipelineAsync/IAsyncMediator.cs
================================================
using System.Threading.Tasks;

namespace FluentMediator.Pipelines.PipelineAsync
{
    /// <summary>
    /// 
    /// </summary>
    public interface IAsyncMediator
    {
        /// <summary>
        /// 
        /// </summary>
        /// <param name="request"></param>
        /// <param name="pipelineName"></param>
        /// <returns></returns>
        Task PublishAsync(object request, string? pipelineName = null);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="request"></param>
        /// <param name="pipelineName"></param>
        /// <typeparam name="TResult"></typeparam>
        /// <returns></returns>
        Task<TResult> SendAsync<TResult>(object request, string? pipelineName = null);
    }
}

================================================
FILE: src/FluentMediator/Pipelines/PipelineAsync/IAsyncPipelineProvider.cs
================================================
using System;

namespace FluentMediator.Pipelines.PipelineAsync
{
    /// <summary>
    /// 
    /// </summary>
    public interface IAsyncPipelineProvider
    {
        /// <summary>
        /// 
        /// </summary>
        /// <param name="requestType"></param>
        /// <returns></returns>
        IPipelineAsync GetAsyncPipeline(Type requestType);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="pipelineName"></param>
        /// <returns></returns>
        IPipelineAsync GetAsyncPipeline(string pipelineName);
    }
}

================================================
FILE: src/FluentMediator/Pipelines/PipelineAsync/IAsyncPipelineProviderBuilder.cs
================================================
namespace FluentMediator.Pipelines.PipelineAsync
{
    /// <summary>
    /// 
    /// </summary>
    public interface IAsyncPipelineProviderBuilder
    {
        /// <summary>
        /// 
        /// </summary>
        /// <param name="pipelineBuilder"></param>
        /// <returns></returns>
        IPipelineAsyncBuilder Add(IPipelineAsyncBuilder pipelineBuilder);
    }
}

================================================
FILE: src/FluentMediator/Pipelines/PipelineAsync/IDirect.cs
================================================
using System.Threading.Tasks;

namespace FluentMediator.Pipelines.PipelineAsync
{
    internal interface IDirect
    {
        Task<TResult> SendAsync<TResult>(
            GetService getService,
            object request
        );
    }
}

================================================
FILE: src/FluentMediator/Pipelines/PipelineAsync/IPipelineAsync.cs
================================================
using System.Threading.Tasks;

namespace FluentMediator.Pipelines.PipelineAsync
{
    /// <summary>
    /// 
    /// </summary>
    public interface IPipelineAsync : INamedPipeline, ITypedPipeline
    {
        /// <summary>
        /// 
        /// </summary>
        /// <param name="getService"></param>
        /// <param name="request"></param>
        /// <returns></returns>
        Task PublishAsync(GetService getService, object request);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="getService"></param>
        /// <param name="request"></param>
        /// <typeparam name="TResult"></typeparam>
        /// <returns></returns>
        Task<TResult> SendAsync<TResult>(GetService getService, object request);
    }
}

================================================
FILE: src/FluentMediator/Pipelines/PipelineAsync/IPipelineAsyncBuilder.cs
================================================
using System;
using System.Threading.Tasks;

namespace FluentMediator.Pipelines.PipelineAsync
{
    /// <summary>
    /// 
    /// </summary>
    /// <typeparam name="TRequest"></typeparam>
    public interface IPipelineAsyncBuilder<TRequest> : IPipelineAsyncBuilder
    {
        /// <summary>
        /// 
        /// </summary>
        /// <param name="func"></param>
        /// <typeparam name="THandler"></typeparam>
        /// <returns></returns>
        IPipelineAsyncBuilder<TRequest> Call<THandler>(Func<THandler, TRequest, Task> func);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="func"></param>
        /// <typeparam name="TResult"></typeparam>
        /// <typeparam name="THandler"></typeparam>
        /// <returns></returns>
        IPipelineAsync Return<TResult, THandler>(Func<THandler, TRequest, Task<TResult>> func);
    }

    /// <summary>
    /// 
    /// </summary>
    public interface IPipelineAsyncBuilder
    {
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        IPipelineAsync Build();
    }
}

================================================
FILE: src/FluentMediator/Pipelines/PipelineAsync/Pipeline.cs
================================================
using System;
using System.Threading.Tasks;

namespace FluentMediator.Pipelines.PipelineAsync
{
    internal sealed class Pipeline : IPipelineAsync
    {
        private readonly IMethodCollection<Method<Func<object, object, Task>>> _methods;
        private readonly IDirect? _direct;

        public Pipeline(IMethodCollection<Method<Func<object, object, Task>>> methods, IDirect? direct, Type requestType, string? name)
        {
            _methods = methods;
            _direct = direct;
            RequestType = requestType;
            Name = name;
        }

        public Type RequestType { get; }
        public string? Name { get; }

        public async Task PublishAsync(GetService getService, object request)
        {
            foreach (var handler in _methods.GetMethods())
            {
                var concreteHandler = getService(handler.HandlerType);
                await handler.Action(concreteHandler, request);
            }
        }

        public async Task<TResult> SendAsync<TResult>(GetService getService, object request)
        {
            if (_direct is null)
            {
                throw new ReturnFunctionIsNullException("The return function is null. SendAsync<TResult> method not executed.");
            }

            foreach (var handler in _methods.GetMethods())
            {
                var concreteHandler = getService(handler.HandlerType);
                await handler.Action(concreteHandler, request);
            }

            return await _direct.SendAsync<TResult>(getService, request!) !;
        }
    }
}

================================================
FILE: src/FluentMediator/Pipelines/PipelineAsync/PipelineBuilder.cs
================================================
using System;
using System.Threading.Tasks;

namespace FluentMediator.Pipelines.PipelineAsync
{
    internal sealed class PipelineBuilder<TRequest> : IPipelineAsyncBuilder<TRequest>
    {
        private readonly IMethodCollection<Method<Func<object, object, Task>>> _methods;
        private IDirect? _direct;
        private string? _name;

        public PipelineBuilder(string? name)
        {
            _methods = new MethodCollection<Method<Func<object, object, Task>>>();
            _name = name;
        }

        public IPipelineAsyncBuilder<TRequest> Call<THandler>(Func<THandler, TRequest, Task> func)
        {
            Func<object, object, Task> typedHandler = async(h, r) => await func((THandler) h, (TRequest) r);
            var method = new Method<Func<object, object, Task>>(typeof(THandler), typedHandler);
            _methods.Add(method);
            return this;
        }

        public IPipelineAsync Return<TResult, THandler>(Func<THandler, TRequest, Task<TResult>> func)
        {
            _direct = new Direct<TRequest, TResult, THandler>(func);
            return Build();
        }

        public IPipelineAsync Build()
        {
            return new Pipeline(_methods, _direct, typeof(TRequest), _name);
        }
    }
}

================================================
FILE: src/FluentMediator/Pipelines/PipelineBehavior.cs
================================================
using FluentMediator.Pipelines.CancellablePipelineAsync;
using FluentMediator.Pipelines.Pipeline;
using FluentMediator.Pipelines.PipelineAsync;

namespace FluentMediator.Pipelines
{
    internal sealed class PipelineBehavior<TRequest> : IPipelineBehavior<TRequest>
    {
        private readonly IPipelineProviderBuilder _pipelineProviderBuilder;

        public PipelineBehavior(IPipelineProviderBuilder pipelineProviderBuilder)
        {
            _pipelineProviderBuilder = pipelineProviderBuilder;
        }

        public IPipelineBuilder<TRequest> Pipeline(string? pipelineName = null)
        {
            var pipelineBuilder = new Pipeline.PipelineBuilder<TRequest>(pipelineName);
            _pipelineProviderBuilder.Add(pipelineBuilder);
            return pipelineBuilder;
        }

        public IPipelineAsyncBuilder<TRequest> PipelineAsync(string? pipelineName = null)
        {
            var pipelineBuilder = new PipelineAsync.PipelineBuilder<TRequest>(pipelineName);
            _pipelineProviderBuilder.Add(pipelineBuilder);
            return pipelineBuilder;
        }

        public ICancellablePipelineAsyncBuilder<TRequest> CancellablePipelineAsync(string? pipelineName = null)
        {
            var pipelineBuilder = new CancellablePipelineAsync.PipelineBuilder<TRequest>(pipelineName);
            _pipelineProviderBuilder.Add(pipelineBuilder);
            return pipelineBuilder;
        }
    }
}

================================================
FILE: src/FluentMediator/Pipelines/PipelineCollection.cs
================================================
using System;
using System.Collections.Generic;

namespace FluentMediator.Pipelines
{
    internal sealed class PipelineCollection<TPipeline> : IPipelineCollection<TPipeline>
        where TPipeline : class, ITypedPipeline, INamedPipeline
        {
            private readonly IDictionary<Type, TPipeline> _typedPipelines;
            private readonly IDictionary<string, TPipeline> _namedPipelines;

            public PipelineCollection()
            {
                _typedPipelines = new Dictionary<Type, TPipeline>();
                _namedPipelines = new Dictionary<string, TPipeline>();
            }

            public void Add(TPipeline pipeline)
            {
                if (pipeline.Name is string)
                {
                    _namedPipelines.Add(pipeline.Name, pipeline);
                }
                else
                {
                    if (_typedPipelines.ContainsKey(pipeline.RequestType))
                    {
                        throw new PipelineAlreadyExistsException($"A pipeline for `{ pipeline.RequestType }` already exists.");
                    }
                    _typedPipelines.Add(pipeline.RequestType, pipeline);
                }
            }

            public TPipeline Get(Type requestType)
            {
                if (_typedPipelines.TryGetValue(requestType, out var pipeline))
                {
                    return pipeline;
                }

                throw new PipelineNotFoundException($"There is no pipeline configured for `{ requestType.GetType() }`.");
            }

            public TPipeline Get(string pipelineName)
            {
                if (_namedPipelines.TryGetValue(pipelineName, out var pipeline))
                {
                    return pipeline;
                }

                throw new PipelineNotFoundException($"There is no pipeline configured for `{ pipelineName }`.");
            }
        }
}

================================================
FILE: src/FluentMediator/Pipelines/PipelineNotFoundException.cs
================================================
namespace FluentMediator.Pipelines
{
    /// <summary>
    /// Occurs when a pipeline for a message was not found
    /// </summary>
    internal sealed class PipelineNotFoundException : MediatorException
    {
        /// <summary>
        /// Instantiate a PipelineNotFoundException
        /// </summary>
        /// <param name="message">The message</param>
        /// <returns>PipelineNotFoundException</returns>
        public PipelineNotFoundException(string message) : base(message) { }
    }
}

================================================
FILE: src/FluentMediator/Pipelines/ReturnFunctionIsNullException.cs
================================================
namespace FluentMediator.Pipelines
{
    /// <summary>
    /// Occurs when a return function was not defined
    /// </summary>
    public sealed class ReturnFunctionIsNullException : MediatorException
    {
        /// <summary>
        /// Instantiate the Exception
        /// </summary>
        /// <param name="message">Exception Message</param>
        /// <returns>An exception</returns>
        public ReturnFunctionIsNullException(string message) : base(message) { }
    }
}

================================================
FILE: src/FluentMediator.Microsoft.Extensions.DependencyInjection/FluentMediator.Microsoft.Extensions.DependencyInjection.csproj
================================================
<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>netstandard1.1</TargetFramework>
    <DocumentationFile>bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml</DocumentationFile>
  </PropertyGroup>
  
  <PropertyGroup>
    <PackageId>FluentMediator.Microsoft.Extensions.DependencyInjection</PackageId>
    <Version>0.4.7</Version>
    <Authors>Ivan Paulovich</Authors>
    <Copyright>Ivan Paulovich</Copyright>
    <Description>Microsoft Extensions for FluentMediator.</Description>
    <PackageDescription>Microsoft Extensions for FluentMediator.</PackageDescription>
    <PackageTags>fluent-design;mediator-pattern;ddd-cqrs;message-bus;event-sourcing;event-driven;chain-of-responsibility;chain-methods;pipelines;dotnet-core;craftmanship;tdd;csharp;pipeline-framework;fluent-interface;event-handlers</PackageTags>
    <IsPackable>true</IsPackable>
    <PackageIcon>icon.png</PackageIcon>
    <RepositoryUrl>https://github.com/ivanpaulovich/FluentMediator</RepositoryUrl>
    <NeutralLanguage>en-US</NeutralLanguage>
	</PropertyGroup>

  <ItemGroup Label="SourceLink">
    <PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" />
  </ItemGroup>

  <PropertyGroup Label="SourceLink">
    <PublishRepositoryUrl>true</PublishRepositoryUrl>
    <IncludeSymbols>true</IncludeSymbols>
    <SymbolPackageFormat>snupkg</SymbolPackageFormat>
  </PropertyGroup>

  <ItemGroup>
    <ProjectReference Include="..\FluentMediator\FluentMediator.csproj" />
  </ItemGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="1.1.0" />
  </ItemGroup>

  <ItemGroup>
    <None Include="../../docs/icon.png">
      <Pack>True</Pack>
      <PackagePath></PackagePath>
    </None>
  </ItemGroup>

</Project>


================================================
FILE: src/FluentMediator.Microsoft.Extensions.DependencyInjection/FluentMediatorExtensions.cs
================================================
using System;
using Microsoft.Extensions.DependencyInjection;

namespace FluentMediator
{
    /// <summary>
    /// FluentMediatorExtensions
    /// </summary>
    public static class FluentMediatorExtensions
    {
        /// <summary>
        /// Adds the FluentMediator
        /// </summary>
        /// <param name="services">The ServiceCollection</param>
        /// <param name="setupAction">Builder</param>
        /// <returns>The changed ServiceCollection</returns>
        public static IServiceCollection AddFluentMediator<TMediator>(
            this IServiceCollection services,
            Action<IPipelineProviderBuilder> setupAction)
        where TMediator : class, IMediator
        {
            var pipelineProviderBuilder = new PipelineProviderBuilder();
            setupAction(pipelineProviderBuilder);
            var pipelineProvider = pipelineProviderBuilder.Build();

            services.AddTransient<GetService>(c => c.GetService);
            services.AddTransient(c => pipelineProvider);
            services.AddTransient<IMediator, TMediator>();

            return services;
        }

        /// <summary>
        /// Adds the FluentMediator
        /// </summary>
        /// <param name="services">The ServiceCollection</param>
        /// <param name="setupAction">Builder</param>
        /// <returns>The changed ServiceCollection</returns>
        public static IServiceCollection AddFluentMediator(this IServiceCollection services, Action<IPipelineProviderBuilder> setupAction)
        {
            var pipelineProviderBuilder = new PipelineProviderBuilder();
            setupAction(pipelineProviderBuilder);
            var pipelineProvider = pipelineProviderBuilder.Build();

            services.AddTransient<GetService>(c => c.GetService);
            services.AddTransient(c => pipelineProvider);
            services.AddTransient<IMediator, Mediator>();

            return services;
        }

        /// <summary>
        /// Adds the FluentMediator
        /// </summary>
        /// <param name="services">The ServiceCollection</param>
        /// <param name="setupAction">Builder</param>
        /// <returns>The changed ServiceCollection</returns>
        public static IServiceCollection AddSingletonFluentMediator(
            this IServiceCollection services,
            Action<IPipelineProviderBuilder> setupAction)
        {
            var pipelineProviderBuilder = new PipelineProviderBuilder();
            setupAction(pipelineProviderBuilder);
            var pipelineProvider = pipelineProviderBuilder.Build();

            services.AddSingleton(c => pipelineProvider);
            services.AddSingleton<GetService>(c => c.GetService);
            services.AddSingleton<IMediator, Mediator>();

            return services;;
        }

        /// <summary>
        /// Adds the FluentMediator
        /// </summary>
        /// <param name="services">The ServiceCollection</param>
        /// <param name="setupAction">Builder</param>
        /// <returns>The changed ServiceCollection</returns>
        public static IServiceCollection AddScopedFluentMediator(
            this IServiceCollection services,
            Action<IPipelineProviderBuilder> setupAction)
        {
            var pipelineProviderBuilder = new PipelineProviderBuilder();
            setupAction(pipelineProviderBuilder);
            var pipelineProvider = pipelineProviderBuilder.Build();

            services.AddScoped(c => pipelineProvider);
            services.AddScoped<GetService>(c => c.GetService);
            services.AddScoped<IMediator, Mediator>();

            return services;
        }
    }
}

================================================
FILE: test/UnitTests/BuildingMediatorTests.cs
================================================
using System;
using FluentMediator;
using FluentMediator.Pipelines;
using Microsoft.Extensions.DependencyInjection;
using UnitTests.PingPong;
using Xunit;

namespace UnitTests
{
    public class BuildingMediatorTests
    {
        [Fact]
        public void BuildSendAsyncPipeline_ThrowsPipelineAlreadyExistsException()
        {
            var services = new ServiceCollection();

            var pipelineProviderBuilder = new PipelineProviderBuilder();

            pipelineProviderBuilder.On<PingRequest>().PipelineAsync()
                .Return<PingResponse, IPingHandler>(
                    (handler, req) => handler.MyCustomFooBarAsync(req)
                );

            pipelineProviderBuilder.On<PingRequest>().PipelineAsync()
                .Return<PingResponse, IPingHandler>(
                    (handler, req) => handler.MyCustomFooBarAsync(req)
                );

            Exception ex = Record.Exception(() => pipelineProviderBuilder.Build());

            Assert.NotNull(ex);
            Assert.IsType<PipelineAlreadyExistsException>(ex);
        }
    }
}

================================================
FILE: test/UnitTests/MyCustomMediator.cs
================================================
using FluentMediator;

namespace UnitTests
{
    public class MyCustomMediator : Mediator
    {
        public bool MyCustomPipelineNotFoundHandlerWasCalled = false;

        public MyCustomMediator(GetService getService, IPipelineProvider pipelines) : base(getService, pipelines)
        { }

        protected override void OnPipelineNotFound(PipelineNotFoundEventArgs e)
        {
            MyCustomPipelineNotFoundHandlerWasCalled = true;

            //Do something before raising the event
            base.OnPipelineNotFound(e);
            //Do something after raising the event 
        }
    }
}

================================================
FILE: test/UnitTests/PingPong/IPingHandler.cs
================================================
using System.Threading;
using System.Threading.Tasks;

namespace UnitTests.PingPong
{
    public interface IPingHandler
    {
        PingResponse MyCustomFooMethod(PingRequest request);
        PingResponse MyCustomBarMethod(PingRequest request);
        Task<PingResponse> MyCustomFooBarAsync(PingRequest request);
        Task<PingResponse> MyCancellableForAsync(PingRequest request, CancellationToken cancelationToken);
    }
}

================================================
FILE: test/UnitTests/PingPong/PingHandler.cs
================================================
using System.Threading;
using System.Threading.Tasks;

namespace UnitTests.PingPong
{
    public class PingHandler : IPingHandler
    {
        public PingResponse MyCustomBarMethod(PingRequest request)
        {
            return new PingResponse("Pong");
        }

        public PingResponse MyCustomFooMethod(PingRequest request)
        {
            return new PingResponse("Pong");
        }

        public Task<PingResponse> MyCustomFooBarAsync(PingRequest request)
        {
            return Task.FromResult(new PingResponse("Pong"));
        }

        public Task<PingResponse> MyCancellableForAsync(PingRequest request, CancellationToken cancelationToken)
        {
            return Task.FromResult(new PingResponse("Pong"));
        }
    }
}

================================================
FILE: test/UnitTests/PingPong/PingRequest.cs
================================================
namespace UnitTests.PingPong
{
    public class PingRequest
    {
        public string Message { get; }

        public PingRequest(string message)
        {
            Message = message;
        }
    }
}

================================================
FILE: test/UnitTests/PingPong/PingResponse.cs
================================================
namespace UnitTests.PingPong
{
    public class PingResponse
    {
        public string Message { get; }

        public PingResponse(string message)
        {
            Message = message;
        }
    }
}

================================================
FILE: test/UnitTests/PublishingRequestsTests.cs
================================================
using System.Threading;
using System.Threading.Tasks;
using FluentMediator;
using Microsoft.Extensions.DependencyInjection;
using Moq;
using UnitTests.PingPong;
using Xunit;

namespace UnitTests
{
    public sealed class PublishingRequestsTests
    {
        [Fact]
        public void Publish_Calls_Pipeline_Handlers()
        {
            var services = new ServiceCollection();
            services.AddFluentMediator(builder =>
            {
                builder.On<PingRequest>().Pipeline()
                    .Call<IPingHandler>((handler, req) => handler.MyCustomFooMethod(req))
                    .Call<IPingHandler>((handler, req) => handler.MyCustomBarMethod(req));
            });
            var pingHandler = new Mock<IPingHandler>();
            services.AddScoped(provider => pingHandler.Object);

            var provider = services.BuildServiceProvider();
            var mediator = provider.GetRequiredService<IMediator>();

            var ping = new PingRequest("Ping");

            //
            // Act
            //
            mediator.Publish(ping);

            pingHandler.Verify(e => e.MyCustomFooMethod(ping), Times.Once);
            pingHandler.Verify(e => e.MyCustomBarMethod(ping), Times.Once);
        }

        [Fact]
        public async Task PublishAsync_Calls_AsyncPipeline_Handlers()
        {
            var services = new ServiceCollection();
            services.AddFluentMediator(builder =>
            {
                builder.On<PingRequest>().PipelineAsync()
                    .Call<IPingHandler>(async(handler, req) => await handler.MyCustomFooBarAsync(req))
                    .Build();
            });
            var pingHandler = new Mock<IPingHandler>();
            services.AddScoped(provider => pingHandler.Object);

            var provider = services.BuildServiceProvider();
            var mediator = provider.GetRequiredService<IMediator>();

            var ping = new PingRequest("Async Ping");

            //
            // Act
            //
            await mediator.PublishAsync(ping);

            pingHandler.Verify(e => e.MyCustomFooBarAsync(ping), Times.Once);
        }

        [Fact]
        public async Task PublishAsync_Calls_CancellablePipeline_Handlers()
        {

            var services = new ServiceCollection();
            services.AddFluentMediator(builder =>
            {
                builder.On<PingRequest>().CancellablePipelineAsync()
                    .Call<IPingHandler>(async(handler, req, ct) => await handler.MyCancellableForAsync(req, ct))
                    .Build();
            });
            var pingHandler = new Mock<IPingHandler>();
            services.AddScoped(provider => pingHandler.Object);

            var provider = services.BuildServiceProvider();
            var mediator = provider.GetRequiredService<IMediator>();

            var cts = new CancellationTokenSource();
            var ping = new PingRequest("Cancellable Async Ping");

            //
            // Act
            //
            await mediator.PublishAsync(ping, cts.Token);

            pingHandler.Verify(e => e.MyCancellableForAsync(ping, It.IsAny<CancellationToken>()), Times.Once);
        }

        [Fact]
        public async Task PublishAsync_Calls_CancellablePipeline_Handlers2()
        {
            var services = new ServiceCollection();
            services.AddFluentMediator(builder =>
            {
                builder.On<PingRequest>().CancellablePipelineAsync()
                    .Call<IPingHandler>(async(handler, req, ct) => await handler.MyCancellableForAsync(req, ct))
                    .Return<PingResponse, IPingHandler>(
                        async(handler, req, ct) => await handler.MyCancellableForAsync(req, ct)
                    );
            });
            var pingHandler = new Mock<IPingHandler>();
            services.AddScoped(provider => pingHandler.Object);

            var provider = services.BuildServiceProvider();
            var mediator = provider.GetRequiredService<IMediator>();

            var cts = new CancellationTokenSource();
            var ping = new PingRequest("Cancellable Async Ping");

            //
            // Act
            //
            await mediator.PublishAsync(ping, cts.Token);

            pingHandler.Verify(e => e.MyCancellableForAsync(ping, It.IsAny<CancellationToken>()), Times.Once);
        }

        [Fact]
        public void Publish_CallsPipelineNotFound_WhenHandlerIsNotSetup()
        {
            var services = new ServiceCollection();
            // Mediator Without the Handler for PingRequest.
            services.AddFluentMediator(builder => { });

            var provider = services.BuildServiceProvider();
            var mediator = provider.GetRequiredService<IMediator>();

            bool myCustomPipelineNotFoundHandlerWasCalled = false;

            // This is handler is called for every message without a destination pipeline.
            mediator.PipelineNotFound += (object sender, PipelineNotFoundEventArgs e) =>
            {
                myCustomPipelineNotFoundHandlerWasCalled = true;
            };

            var cts = new CancellationTokenSource();
            var ping = new PingRequest("Cancellable Async Ping");

            // Should run without throwing exceptions
            mediator.Publish(ping);

            // The method was called :)
            Assert.True(myCustomPipelineNotFoundHandlerWasCalled);
        }

        [Fact]
        public void Publish_CallsCustomPipelineNotFound_WhenHandlerIsNotSetup()
        {
            var services = new ServiceCollection();

            // Mediator Without the Handler for PingRequest.
            services.AddFluentMediator<MyCustomMediator>(builder => { });

            var provider = services.BuildServiceProvider();
            var mediator = (MyCustomMediator) provider.GetRequiredService<IMediator>();

            var cts = new CancellationTokenSource();
            var ping = new PingRequest("Cancellable Async Ping");

            // Should run without throwing exceptions
            mediator.Publish(ping);

            // The method was called :)
            Assert.True(mediator.MyCustomPipelineNotFoundHandlerWasCalled);
        }
    }
}

================================================
FILE: test/UnitTests/SendingRequestTests.cs
================================================
using System.Threading;
using System.Threading.Tasks;
using FluentMediator;
using FluentMediator.Pipelines;
using Microsoft.Extensions.DependencyInjection;
using Moq;
using UnitTests.PingPong;
using Xunit;

namespace UnitTests
{
    public class SendingRequestTests
    {
        [Fact]
        public void Send_Without_Return_Throws_ReturnFunctionIsNullException()
        {
            var services = new ServiceCollection();
            services.AddFluentMediator(m =>
            {
                m.On<PingRequest>().Pipeline()
                    .Call<IPingHandler>((handler, req) => handler.MyCustomFooMethod(req))
                    .Call<IPingHandler>((handler, req) => handler.MyCustomBarMethod(req));
            });
            var pingHandler = new Mock<IPingHandler>();
            services.AddScoped(provider => pingHandler.Object);

            var provider = services.BuildServiceProvider();
            var mediator = provider.GetRequiredService<IMediator>();

            var ping = new PingRequest("Ping");

            var actualEx = Record.Exception(
                //
                // Act
                //
                () => mediator.Send<PingResponse>(ping)
            );

            Assert.IsType<ReturnFunctionIsNullException>(actualEx);
        }

        [Fact]
        public void SendAsync_Without_Return_Throws_ReturnFunctionIsNullException()
        {
            var services = new ServiceCollection();
            services.AddFluentMediator(m =>
            {
                m.On<PingRequest>().PipelineAsync()
                    .Call<IPingHandler>((handler, req) => handler.MyCustomFooBarAsync(req))
                    .Call<IPingHandler>((handler, req) => handler.MyCustomFooBarAsync(req));
            });
            var pingHandler = new Mock<IPingHandler>();
            services.AddScoped<IPingHandler>(provider => pingHandler.Object);

            var provider = services.BuildServiceProvider();
            var mediator = provider.GetRequiredService<IMediator>();

            var ping = new PingRequest("Ping");

            var actualEx = Record.ExceptionAsync(
                //
                // Act
                //
                async() => await mediator.SendAsync<PingResponse>(ping)
            );

            Assert.IsType<ReturnFunctionIsNullException>(actualEx.Result);

            pingHandler.Verify(e => e.MyCustomFooMethod(ping), Times.Never);
            pingHandler.Verify(e => e.MyCustomBarMethod(ping), Times.Never);
        }

        [Fact]
        public void CancellableSendAsync_Without_Return_Throws_ReturnFunctionIsNullException()
        {
            var services = new ServiceCollection();
            services.AddFluentMediator(m =>
            {
                m.On<PingRequest>().CancellablePipelineAsync()
                    .Call<IPingHandler>((handler, req, ct) => handler.MyCancellableForAsync(req, ct))
                    .Call<IPingHandler>((handler, req, ct) => handler.MyCancellableForAsync(req, ct));
            });
            var pingHandler = new Mock<IPingHandler>();
            services.AddScoped<IPingHandler>(provider => pingHandler.Object);

            var provider = services.BuildServiceProvider();
            var mediator = provider.GetRequiredService<IMediator>();
            var cts = new CancellationTokenSource();

            var ping = new PingRequest("Ping");

            var actualEx = Record.ExceptionAsync(
                //
                // Act
                //
                async() => await mediator.SendAsync<PingResponse>(ping, cts.Token)
            );

            Assert.IsType<ReturnFunctionIsNullException>(actualEx.Result);
        }

        [Fact]
        public async Task SendAsync_Returns_Response()
        {
            var services = new ServiceCollection();
            services.AddFluentMediator(m =>
            {
                m.On<PingRequest>().PipelineAsync()
                    .Return<PingResponse, IPingHandler>(
                        (handler, req) => handler.MyCustomFooBarAsync(req)
                    );
            });
            services.AddScoped<IPingHandler, PingHandler>();
            var provider = services.BuildServiceProvider();
            var mediator = provider.GetRequiredService<IMediator>();

            var ping = new PingRequest("Ping");
            var response = await mediator.SendAsync<PingResponse>(ping);

            Assert.NotNull(response);
        }

        [Fact]
        public void Send_Returns_Response()
        {
            var services = new ServiceCollection();
            services.AddFluentMediator(m =>
            {
                m.On<PingRequest>()
                    .Pipeline()
                    .Return<PingResponse, IPingHandler>(
                        (handler, req) => handler.MyCustomFooMethod(req)
                    );
            });

            services.AddScoped<IPingHandler, PingHandler>();
            var provider = services.BuildServiceProvider();
            var mediator = provider.GetRequiredService<IMediator>();

            var ping = new PingRequest("Ping");
            var response = mediator.Send<PingResponse>(ping);

            Assert.NotNull(response);
        }

        [Fact]
        public void Send_Named_PipelineReturns_Response()
        {
            var services = new ServiceCollection();
            services.AddFluentMediator(m =>
            {
                m.On<PingRequest>()
                    .Pipeline()
                    .Return<PingResponse, IPingHandler>(
                        (handler, req) => handler.MyCustomFooMethod(req)
                    );
                m.On<PingRequest>()
                    .Pipeline("Foo")
                    .Return<PingResponse, IPingHandler>(
                        (handler, req) => handler.MyCustomFooMethod(req)
                    );
            });

            services.AddScoped<IPingHandler, PingHandler>();
            var provider = services.BuildServiceProvider();
            var mediator = provider.GetRequiredService<IMediator>();

            var ping = new PingRequest("Ping");
            var response = mediator.Send<PingResponse>(ping, "Foo");

            Assert.NotNull(response);
        }

        [Fact]
        public async Task Send_Named_PipelineAsync_Returns_Response()
        {
            var services = new ServiceCollection();
            services.AddFluentMediator(m =>
            {
                m.On<PingRequest>()
                    .PipelineAsync()
                    .Return<PingResponse, IPingHandler>(
                        (handler, req) => handler.MyCustomFooBarAsync(req)
                    );
                m.On<PingRequest>()
                    .PipelineAsync("Foo")
                    .Return<PingResponse, IPingHandler>(
                        (handler, req) => handler.MyCustomFooBarAsync(req)
                    );
            });

            services.AddScoped<IPingHandler, PingHandler>();
            var provider = services.BuildServiceProvider();
            var mediator = provider.GetRequiredService<IMediator>();

            var ping = new PingRequest("Ping");
            var response = await mediator.SendAsync<PingResponse>(ping, "Foo");

            Assert.NotNull(response);
        }

        [Fact]
        public async Task SendCancellable_Named_PipelineReturns_Response()
        {
            var services = new ServiceCollection();
            services.AddFluentMediator(m =>
            {
                m.On<PingRequest>()
                    .CancellablePipelineAsync()
                    .Return<PingResponse, IPingHandler>(
                        (handler, req, ct) => handler.MyCancellableForAsync(req, ct)
                    );
                m.On<PingRequest>()
                    .CancellablePipelineAsync("Foo")
                    .Return<PingResponse, IPingHandler>(
                        (handler, req, ct) => handler.MyCancellableForAsync(req, ct)
                    );
            });

            services.AddScoped<IPingHandler, PingHandler>();
            var provider = services.BuildServiceProvider();
            var mediator = provider.GetRequiredService<IMediator>();
            var cts = new CancellationTokenSource();

            var ping = new PingRequest("Ping");
            var response = await mediator.SendAsync<PingResponse>(ping, cts.Token, "Foo");

            Assert.NotNull(response);
        }

        [Fact]
        public void Send_Throws_Exception_Null_Requests()
        {
            var services = new ServiceCollection();
            services.AddFluentMediator(m => { });

            services.AddScoped<IPingHandler, PingHandler>();
            var provider = services.BuildServiceProvider();
            var mediator = provider.GetRequiredService<IMediator>();

            var actualEx = Record.Exception(() => mediator.Send<PingResponse>(null!));

            Assert.NotNull(actualEx);
            Assert.IsType<NullRequestException>(actualEx);
        }
    }
}

================================================
FILE: test/UnitTests/UnitTests.csproj
================================================
<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>netcoreapp2.2</TargetFramework>
    <IsPackable>false</IsPackable>
    <Nullable>enable</Nullable>
    <NullableReferenceTypes>true</NullableReferenceTypes>
    <LangVersion>8.0</LangVersion>
    <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.4.0" />
    <PackageReference Include="xunit" Version="2.4.1" />
    <PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" />
    <DotNetCliToolReference Include="dotnet-xunit" Version="2.3.1" />
    <PackageReference Include="Microsoft.AspNetCore.App" />
    <PackageReference Include="Moq" Version="4.13.1"/>
  </ItemGroup>

  <ItemGroup>
    <ProjectReference Include="..\..\src\FluentMediator\FluentMediator.csproj" />
    <ProjectReference Include="..\..\src\FluentMediator.Microsoft.Extensions.DependencyInjection\FluentMediator.Microsoft.Extensions.DependencyInjection.csproj" />
  </ItemGroup>

</Project>
Download .txt
gitextract_qjfzijxk/

├── .all-contributorsrc
├── .editorconfig
├── .gitignore
├── .vscode/
│   ├── launch.json
│   ├── settings.json
│   └── tasks.json
├── FluentMediator.sln
├── LICENSE
├── README.md
├── azure-pipelines-1.yml
├── azure-pipelines.yml
├── changelog.md
├── docs/
│   └── icon.xcf
├── samples/
│   ├── AspNetCore/
│   │   ├── .vscode/
│   │   │   ├── launch.json
│   │   │   └── tasks.json
│   │   ├── Wallet.sln
│   │   ├── src/
│   │   │   ├── Core/
│   │   │   │   ├── Core.csproj
│   │   │   │   ├── Services/
│   │   │   │   │   └── ICustomerRepository.cs
│   │   │   │   ├── UseCases/
│   │   │   │   │   ├── IRegisterUseCase.cs
│   │   │   │   │   ├── Register.cs
│   │   │   │   │   ├── RegisterCommand.cs
│   │   │   │   │   └── RegisterResponse.cs
│   │   │   │   └── Wallet/
│   │   │   │       └── Customer.cs
│   │   │   ├── Infrastructure/
│   │   │   │   ├── InMemory/
│   │   │   │   │   └── CustomerRepository.cs
│   │   │   │   └── Infrastructure.csproj
│   │   │   └── WebApi/
│   │   │       ├── Controllers/
│   │   │       │   └── Register/
│   │   │       │       ├── CustomersController.cs
│   │   │       │       └── RegisterRequest.cs
│   │   │       ├── Program.cs
│   │   │       ├── Startup.cs
│   │   │       ├── WebApi.csproj
│   │   │       ├── appsettings.Development.json
│   │   │       └── appsettings.json
│   │   └── test/
│   │       └── UnitTests/
│   │           ├── UnitTests.csproj
│   │           └── UseCasesTests/
│   │               └── RegisterTests.cs
│   └── SimpleConsoleApp/
│       ├── .vscode/
│       │   ├── launch.json
│       │   ├── settings.json
│       │   └── tasks.json
│       ├── PingPong/
│       │   ├── PingHandler.cs
│       │   ├── PingPong.csproj
│       │   ├── PingRequest.cs
│       │   └── Program.cs
│       └── Samples.sln
├── src/
│   ├── FluentMediator/
│   │   ├── FluentMediator.csproj
│   │   ├── GetService.cs
│   │   ├── IMediator.cs
│   │   ├── IPipelineProvider.cs
│   │   ├── IPipelineProviderBuilder.cs
│   │   ├── Mediator.cs
│   │   ├── MediatorException.cs
│   │   ├── NullRequestException.cs
│   │   ├── PipelineNotFoundEventArgs.cs
│   │   ├── PipelineProvider.cs
│   │   ├── PipelineProviderBuilder.cs
│   │   └── Pipelines/
│   │       ├── CancellablePipelineAsync/
│   │       │   ├── Direct.cs
│   │       │   ├── ICancellableMediator.cs
│   │       │   ├── ICancellablePipelineAsync.cs
│   │       │   ├── ICancellablePipelineAsyncBuilder.cs
│   │       │   ├── ICancellablePipelineProvider.cs
│   │       │   ├── ICancellablePipelineProviderBuilder.cs
│   │       │   ├── IDirect.cs
│   │       │   ├── Pipeline.cs
│   │       │   └── PipelineBuilder.cs
│   │       ├── IMethodCollection.cs
│   │       ├── INamedPipeline.cs
│   │       ├── IPipelineBehavior.cs
│   │       ├── IPipelineCollection.cs
│   │       ├── ITypedPipeline.cs
│   │       ├── Method.cs
│   │       ├── MethodCollection.cs
│   │       ├── Pipeline/
│   │       │   ├── Direct.cs
│   │       │   ├── IDirect.cs
│   │       │   ├── IPipeline.cs
│   │       │   ├── IPipelineBuilder.cs
│   │       │   ├── ISyncMediator.cs
│   │       │   ├── ISyncPipelineProvider.cs
│   │       │   ├── ISyncPipelineProviderBuilder.cs
│   │       │   ├── Pipeline.cs
│   │       │   └── PipelineBuilder.cs
│   │       ├── PipelineAlreadyExistsException.cs
│   │       ├── PipelineAsync/
│   │       │   ├── Direct.cs
│   │       │   ├── IAsyncMediator.cs
│   │       │   ├── IAsyncPipelineProvider.cs
│   │       │   ├── IAsyncPipelineProviderBuilder.cs
│   │       │   ├── IDirect.cs
│   │       │   ├── IPipelineAsync.cs
│   │       │   ├── IPipelineAsyncBuilder.cs
│   │       │   ├── Pipeline.cs
│   │       │   └── PipelineBuilder.cs
│   │       ├── PipelineBehavior.cs
│   │       ├── PipelineCollection.cs
│   │       ├── PipelineNotFoundException.cs
│   │       └── ReturnFunctionIsNullException.cs
│   └── FluentMediator.Microsoft.Extensions.DependencyInjection/
│       ├── FluentMediator.Microsoft.Extensions.DependencyInjection.csproj
│       └── FluentMediatorExtensions.cs
└── test/
    └── UnitTests/
        ├── BuildingMediatorTests.cs
        ├── MyCustomMediator.cs
        ├── PingPong/
        │   ├── IPingHandler.cs
        │   ├── PingHandler.cs
        │   ├── PingRequest.cs
        │   └── PingResponse.cs
        ├── PublishingRequestsTests.cs
        ├── SendingRequestTests.cs
        └── UnitTests.csproj
Download .txt
SYMBOL INDEX (239 symbols across 72 files)

FILE: samples/AspNetCore/src/Core/Services/ICustomerRepository.cs
  type ICustomerRepository (line 5) | public interface ICustomerRepository
    method Add (line 7) | void Add(Customer customer);

FILE: samples/AspNetCore/src/Core/UseCases/IRegisterUseCase.cs
  type IRegisterUseCase (line 3) | public interface IRegisterUseCase
    method Execute (line 5) | RegisterResponse Execute(RegisterCommand registerCommand);

FILE: samples/AspNetCore/src/Core/UseCases/Register.cs
  class Register (line 6) | public class Register : IRegisterUseCase
    method Register (line 10) | public Register(ICustomerRepository customerRepository)
    method Execute (line 15) | public RegisterResponse Execute(RegisterCommand registerCommand)

FILE: samples/AspNetCore/src/Core/UseCases/RegisterCommand.cs
  class RegisterCommand (line 3) | public class RegisterCommand
    method RegisterCommand (line 9) | public RegisterCommand(string name, string ssn, decimal balance)

FILE: samples/AspNetCore/src/Core/UseCases/RegisterResponse.cs
  class RegisterResponse (line 5) | public class RegisterResponse
    method RegisterResponse (line 9) | public RegisterResponse(Guid userId)

FILE: samples/AspNetCore/src/Core/Wallet/Customer.cs
  class Customer (line 5) | public class Customer
    method Customer (line 13) | public Customer(string name, string ssn, decimal balance)

FILE: samples/AspNetCore/src/Infrastructure/InMemory/CustomerRepository.cs
  class CustomerRepository (line 7) | public class CustomerRepository : ICustomerRepository
    method CustomerRepository (line 11) | public CustomerRepository()
    method Add (line 16) | public void Add(Customer customer)

FILE: samples/AspNetCore/src/WebApi/Controllers/Register/CustomersController.cs
  class CustomersController (line 8) | [Route("api/[controller]")]
    method CustomersController (line 14) | public CustomersController(IMediator mediator)
    method Post (line 19) | [HttpPost]

FILE: samples/AspNetCore/src/WebApi/Controllers/Register/RegisterRequest.cs
  class RegisterRequest (line 3) | public class RegisterRequest

FILE: samples/AspNetCore/src/WebApi/Program.cs
  class Program (line 12) | public class Program
    method Main (line 14) | public static void Main(string[] args)
    method CreateHostBuilder (line 19) | public static IHostBuilder CreateHostBuilder(string[] args) =>

FILE: samples/AspNetCore/src/WebApi/Startup.cs
  class Startup (line 21) | public class Startup
    method Startup (line 23) | public Startup(IConfiguration configuration)
    method ConfigureServices (line 31) | public void ConfigureServices(IServiceCollection services)
    method Configure (line 47) | public void Configure(IApplicationBuilder app, IWebHostEnvironment env)

FILE: samples/AspNetCore/test/UnitTests/UseCasesTests/RegisterTests.cs
  class RegisterTests (line 7) | public class RegisterTests
    method Register_PublishesEvent (line 9) | [Fact]

FILE: samples/SimpleConsoleApp/PingPong/PingHandler.cs
  class PingHandler (line 7) | public class PingHandler
    method MyMethod (line 9) | public void MyMethod(PingRequest request)
    method MyLongMethod (line 14) | public void MyLongMethod(PingRequest request)
    method MyMethodAsync (line 19) | public async Task MyMethodAsync(PingRequest request)
    method MyMethodAsync (line 25) | public async Task MyMethodAsync(PingRequest request, CancellationToken...

FILE: samples/SimpleConsoleApp/PingPong/PingRequest.cs
  class PingRequest (line 3) | public class PingRequest
    method PingRequest (line 7) | public PingRequest(string message)

FILE: samples/SimpleConsoleApp/PingPong/Program.cs
  class Program (line 8) | class Program
    method Main (line 10) | static void Main(string[] args)

FILE: src/FluentMediator.Microsoft.Extensions.DependencyInjection/FluentMediatorExtensions.cs
  class FluentMediatorExtensions (line 9) | public static class FluentMediatorExtensions
    method AddFluentMediator (line 17) | public static IServiceCollection AddFluentMediator<TMediator>(
    method AddFluentMediator (line 39) | public static IServiceCollection AddFluentMediator(this IServiceCollec...
    method AddSingletonFluentMediator (line 58) | public static IServiceCollection AddSingletonFluentMediator(
    method AddScopedFluentMediator (line 79) | public static IServiceCollection AddScopedFluentMediator(

FILE: src/FluentMediator/IMediator.cs
  type IMediator (line 11) | public interface IMediator:

FILE: src/FluentMediator/IPipelineProvider.cs
  type IPipelineProvider (line 10) | public interface IPipelineProvider:

FILE: src/FluentMediator/IPipelineProviderBuilder.cs
  type IPipelineProviderBuilder (line 11) | public interface IPipelineProviderBuilder:
    method On (line 21) | IPipelineBehavior<TRequest> On<TRequest>();
    method Build (line 27) | IPipelineProvider Build();

FILE: src/FluentMediator/Mediator.cs
  class Mediator (line 11) | public class Mediator : IMediator
    method Mediator (line 31) | public Mediator(
    method Publish (line 44) | public void Publish(object request, string? pipelineName = null)
    method Send (line 78) | public TResult Send<TResult>(object request, string? pipelineName = null)
    method PublishAsync (line 103) | public async Task PublishAsync(object request, string? pipelineName = ...
    method SendAsync (line 129) | public async Task<TResult> SendAsync<TResult>(object request, string? ...
    method PublishAsync (line 155) | public async Task PublishAsync(object request, CancellationToken cance...
    method SendAsync (line 182) | public async Task<TResult> SendAsync<TResult>(object request, Cancella...
    method OnPipelineNotFound (line 205) | protected virtual void OnPipelineNotFound(PipelineNotFoundEventArgs e)

FILE: src/FluentMediator/MediatorException.cs
  class MediatorException (line 8) | public class MediatorException : Exception
    method MediatorException (line 15) | public MediatorException(string message) : base(message) { }

FILE: src/FluentMediator/NullRequestException.cs
  class NullRequestException (line 6) | public class NullRequestException : MediatorException
    method NullRequestException (line 13) | public NullRequestException(string message) : base(message) { }

FILE: src/FluentMediator/PipelineNotFoundEventArgs.cs
  class PipelineNotFoundEventArgs (line 8) | public class PipelineNotFoundEventArgs : EventArgs
    method PipelineNotFoundEventArgs (line 20) | public PipelineNotFoundEventArgs(object message)

FILE: src/FluentMediator/PipelineProvider.cs
  class PipelineProvider (line 12) | internal sealed class PipelineProvider : IPipelineProvider
    method PipelineProvider (line 24) | public PipelineProvider(
    method GetAsyncPipeline (line 39) | public IPipelineAsync GetAsyncPipeline(Type requestType)
    method GetAsyncPipeline (line 49) | public IPipelineAsync GetAsyncPipeline(string pipelineName)
    method GetCancellablePipeline (line 59) | public ICancellablePipelineAsync GetCancellablePipeline(Type requestType)
    method GetCancellablePipeline (line 69) | public ICancellablePipelineAsync GetCancellablePipeline(string pipelin...
    method GetPipeline (line 79) | public IPipeline GetPipeline(Type requestType)
    method GetPipeline (line 89) | public IPipeline GetPipeline(string pipelineName)

FILE: src/FluentMediator/PipelineProviderBuilder.cs
  class PipelineProviderBuilder (line 13) | public class PipelineProviderBuilder : IPipelineProviderBuilder
    method PipelineProviderBuilder (line 22) | public PipelineProviderBuilder()
    method On (line 34) | public IPipelineBehavior<TRequest> On<TRequest>()
    method Add (line 45) | public IPipelineBuilder Add(IPipelineBuilder pipelineBuilder)
    method Add (line 56) | public IPipelineAsyncBuilder Add(IPipelineAsyncBuilder pipelineBuilder)
    method Add (line 67) | public ICancellablePipelineAsyncBuilder Add(ICancellablePipelineAsyncB...
    method Build (line 77) | public IPipelineProvider Build()

FILE: src/FluentMediator/Pipelines/CancellablePipelineAsync/Direct.cs
  class Direct (line 7) | internal sealed class Direct<TRequest, TResult, THandler> : IDirect
    method Direct (line 11) | public Direct(Func<THandler, TRequest, CancellationToken, Task<TResult...
    method SendAsync (line 17) | public async Task<TResponse> SendAsync<TResponse>(GetService getServic...

FILE: src/FluentMediator/Pipelines/CancellablePipelineAsync/ICancellableMediator.cs
  type ICancellableMediator (line 9) | public interface ICancellableMediator
    method PublishAsync (line 18) | Task PublishAsync(object request, CancellationToken cancellationToken,...
    method SendAsync (line 28) | Task<TResult> SendAsync<TResult>(object request, CancellationToken can...

FILE: src/FluentMediator/Pipelines/CancellablePipelineAsync/ICancellablePipelineAsync.cs
  type ICancellablePipelineAsync (line 9) | public interface ICancellablePipelineAsync : INamedPipeline, ITypedPipeline
    method PublishAsync (line 18) | Task PublishAsync(GetService getService, object request, CancellationT...
    method SendAsync (line 28) | Task<TResult> SendAsync<TResult>(GetService getService, object request...

FILE: src/FluentMediator/Pipelines/CancellablePipelineAsync/ICancellablePipelineAsyncBuilder.cs
  type ICancellablePipelineAsyncBuilder (line 11) | public interface ICancellablePipelineAsyncBuilder<TRequest> : ICancellab...
    method Call (line 19) | ICancellablePipelineAsyncBuilder<TRequest> Call<THandler>(Func<THandle...
    method Return (line 28) | ICancellablePipelineAsync Return<TResult, THandler>(Func<THandler, TRe...
    method Build (line 40) | ICancellablePipelineAsync Build();
  type ICancellablePipelineAsyncBuilder (line 34) | public interface ICancellablePipelineAsyncBuilder
    method Call (line 19) | ICancellablePipelineAsyncBuilder<TRequest> Call<THandler>(Func<THandle...
    method Return (line 28) | ICancellablePipelineAsync Return<TResult, THandler>(Func<THandler, TRe...
    method Build (line 40) | ICancellablePipelineAsync Build();

FILE: src/FluentMediator/Pipelines/CancellablePipelineAsync/ICancellablePipelineProvider.cs
  type ICancellablePipelineProvider (line 8) | public interface ICancellablePipelineProvider
    method GetCancellablePipeline (line 15) | ICancellablePipelineAsync GetCancellablePipeline(Type requestType);
    method GetCancellablePipeline (line 22) | ICancellablePipelineAsync GetCancellablePipeline(string pipelineName);

FILE: src/FluentMediator/Pipelines/CancellablePipelineAsync/ICancellablePipelineProviderBuilder.cs
  type ICancellablePipelineProviderBuilder (line 6) | public interface ICancellablePipelineProviderBuilder
    method Add (line 13) | ICancellablePipelineAsyncBuilder Add(ICancellablePipelineAsyncBuilder ...

FILE: src/FluentMediator/Pipelines/CancellablePipelineAsync/IDirect.cs
  type IDirect (line 6) | internal interface IDirect
    method SendAsync (line 8) | Task<TResult> SendAsync<TResult>(

FILE: src/FluentMediator/Pipelines/CancellablePipelineAsync/Pipeline.cs
  class Pipeline (line 7) | internal sealed class Pipeline : ICancellablePipelineAsync
    method Pipeline (line 12) | public Pipeline(IMethodCollection<Method<Func<object, object, Cancella...
    method PublishAsync (line 26) | public async Task PublishAsync(GetService getService, object request, ...
    method SendAsync (line 37) | public async Task<TResult> SendAsync<TResult>(GetService getService, o...

FILE: src/FluentMediator/Pipelines/CancellablePipelineAsync/PipelineBuilder.cs
  class PipelineBuilder (line 7) | internal class PipelineBuilder<TRequest> : ICancellablePipelineAsyncBuil...
    method PipelineBuilder (line 13) | public PipelineBuilder(string? name)
    method Call (line 19) | public ICancellablePipelineAsyncBuilder<TRequest> Call<THandler>(Func<...
    method Return (line 27) | public ICancellablePipelineAsync Return<TResult, THandler>(Func<THandl...
    method Build (line 33) | public ICancellablePipelineAsync Build()

FILE: src/FluentMediator/Pipelines/IMethodCollection.cs
  type IMethodCollection (line 5) | internal interface IMethodCollection<Method>
    method GetMethods (line 7) | ReadOnlyCollection<Method> GetMethods();
    method Add (line 8) | void Add(Method method);

FILE: src/FluentMediator/Pipelines/INamedPipeline.cs
  type INamedPipeline (line 6) | public interface INamedPipeline

FILE: src/FluentMediator/Pipelines/IPipelineBehavior.cs
  type IPipelineBehavior (line 11) | public interface IPipelineBehavior<TRequest>
    method Pipeline (line 18) | IPipelineBuilder<TRequest> Pipeline(string? pipelineName = null);
    method PipelineAsync (line 25) | IPipelineAsyncBuilder<TRequest> PipelineAsync(string? pipelineName = n...
    method CancellablePipelineAsync (line 32) | ICancellablePipelineAsyncBuilder<TRequest> CancellablePipelineAsync(st...

FILE: src/FluentMediator/Pipelines/IPipelineCollection.cs
  type IPipelineCollection (line 5) | internal interface IPipelineCollection<TPipeline> where TPipeline : clas...
    method Add (line 7) | void Add(TPipeline pipeline);
    method Get (line 8) | TPipeline Get(Type requestType);
    method Get (line 9) | TPipeline Get(string pipelineName);

FILE: src/FluentMediator/Pipelines/ITypedPipeline.cs
  type ITypedPipeline (line 8) | public interface ITypedPipeline

FILE: src/FluentMediator/Pipelines/Method.cs
  class Method (line 5) | internal sealed class Method<TAction>
    method Method (line 10) | public Method(Type handlerType, TAction action)

FILE: src/FluentMediator/Pipelines/MethodCollection.cs
  class MethodCollection (line 6) | internal sealed class MethodCollection<Method> : IMethodCollection<Method>
    method MethodCollection (line 10) | public MethodCollection()
    method GetMethods (line 15) | public ReadOnlyCollection<Method> GetMethods()
    method Add (line 20) | public void Add(Method method)

FILE: src/FluentMediator/Pipelines/Pipeline/Direct.cs
  class Direct (line 5) | internal sealed class Direct<TRequest, TResult, THandler> : IDirect
    method Direct (line 9) | public Direct(Func<THandler, TRequest, TResult> action)
    method Send (line 15) | public TResponse Send<TResponse>(GetService getService, object request)

FILE: src/FluentMediator/Pipelines/Pipeline/IDirect.cs
  type IDirect (line 3) | internal interface IDirect
    method Send (line 5) | TResult Send<TResult>(

FILE: src/FluentMediator/Pipelines/Pipeline/IPipeline.cs
  type IPipeline (line 6) | public interface IPipeline : INamedPipeline, ITypedPipeline
    method Publish (line 13) | void Publish(GetService getService, object request);
    method Send (line 22) | TResult Send<TResult>(GetService getService, object request);

FILE: src/FluentMediator/Pipelines/Pipeline/IPipelineBuilder.cs
  type IPipelineBuilder (line 9) | public interface IPipelineBuilder<TRequest> : IPipelineBuilder
    method Call (line 17) | IPipelineBuilder<TRequest> Call<THandler>(Action<THandler, TRequest> a...
    method Return (line 26) | IPipeline Return<TResult, THandler>(Func<THandler, TRequest, TResult> ...
    method Build (line 38) | IPipeline Build();
  type IPipelineBuilder (line 32) | public interface IPipelineBuilder
    method Call (line 17) | IPipelineBuilder<TRequest> Call<THandler>(Action<THandler, TRequest> a...
    method Return (line 26) | IPipeline Return<TResult, THandler>(Func<THandler, TRequest, TResult> ...
    method Build (line 38) | IPipeline Build();

FILE: src/FluentMediator/Pipelines/Pipeline/ISyncMediator.cs
  type ISyncMediator (line 6) | public interface ISyncMediator
    method Publish (line 13) | void Publish(object request, string? pipelineName = null);
    method Send (line 22) | TResult Send<TResult>(object request, string? pipelineName = null);

FILE: src/FluentMediator/Pipelines/Pipeline/ISyncPipelineProvider.cs
  type ISyncPipelineProvider (line 8) | public interface ISyncPipelineProvider
    method GetPipeline (line 15) | IPipeline GetPipeline(Type requestType);
    method GetPipeline (line 22) | IPipeline GetPipeline(string pipelineName);

FILE: src/FluentMediator/Pipelines/Pipeline/ISyncPipelineProviderBuilder.cs
  type ISyncPipelineProviderBuilder (line 6) | public interface ISyncPipelineProviderBuilder
    method Add (line 13) | IPipelineBuilder Add(IPipelineBuilder pipelineBuilder);

FILE: src/FluentMediator/Pipelines/Pipeline/Pipeline.cs
  class Pipeline (line 5) | internal sealed class Pipeline : IPipeline
    method Pipeline (line 10) | public Pipeline(IMethodCollection<Method<Action<object, object>>> meth...
    method Publish (line 21) | public void Publish(GetService getService, object request)
    method Send (line 30) | public TResult Send<TResult>(GetService getService, object request)

FILE: src/FluentMediator/Pipelines/Pipeline/PipelineBuilder.cs
  class PipelineBuilder (line 5) | internal sealed class PipelineBuilder<TRequest> : IPipelineBuilder<TRequ...
    method PipelineBuilder (line 11) | public PipelineBuilder(string? name)
    method Call (line 17) | public IPipelineBuilder<TRequest> Call<THandler>(Action<THandler, TReq...
    method Return (line 25) | public IPipeline Return<TResult, THandler>(Func<THandler, TRequest, TR...
    method Build (line 31) | public IPipeline Build()

FILE: src/FluentMediator/Pipelines/PipelineAlreadyExistsException.cs
  class PipelineAlreadyExistsException (line 6) | public sealed class PipelineAlreadyExistsException : MediatorException
    method PipelineAlreadyExistsException (line 13) | public PipelineAlreadyExistsException(string message) : base(message) { }

FILE: src/FluentMediator/Pipelines/PipelineAsync/Direct.cs
  class Direct (line 6) | internal sealed class Direct<TRequest, TResult, THandler> : IDirect
    method Direct (line 10) | public Direct(Func<THandler, TRequest, Task<TResult>> action)
    method SendAsync (line 16) | public async Task<TResponse> SendAsync<TResponse>(GetService getServic...

FILE: src/FluentMediator/Pipelines/PipelineAsync/IAsyncMediator.cs
  type IAsyncMediator (line 8) | public interface IAsyncMediator
    method PublishAsync (line 16) | Task PublishAsync(object request, string? pipelineName = null);
    method SendAsync (line 25) | Task<TResult> SendAsync<TResult>(object request, string? pipelineName ...

FILE: src/FluentMediator/Pipelines/PipelineAsync/IAsyncPipelineProvider.cs
  type IAsyncPipelineProvider (line 8) | public interface IAsyncPipelineProvider
    method GetAsyncPipeline (line 15) | IPipelineAsync GetAsyncPipeline(Type requestType);
    method GetAsyncPipeline (line 22) | IPipelineAsync GetAsyncPipeline(string pipelineName);

FILE: src/FluentMediator/Pipelines/PipelineAsync/IAsyncPipelineProviderBuilder.cs
  type IAsyncPipelineProviderBuilder (line 6) | public interface IAsyncPipelineProviderBuilder
    method Add (line 13) | IPipelineAsyncBuilder Add(IPipelineAsyncBuilder pipelineBuilder);

FILE: src/FluentMediator/Pipelines/PipelineAsync/IDirect.cs
  type IDirect (line 5) | internal interface IDirect
    method SendAsync (line 7) | Task<TResult> SendAsync<TResult>(

FILE: src/FluentMediator/Pipelines/PipelineAsync/IPipelineAsync.cs
  type IPipelineAsync (line 8) | public interface IPipelineAsync : INamedPipeline, ITypedPipeline
    method PublishAsync (line 16) | Task PublishAsync(GetService getService, object request);
    method SendAsync (line 25) | Task<TResult> SendAsync<TResult>(GetService getService, object request);

FILE: src/FluentMediator/Pipelines/PipelineAsync/IPipelineAsyncBuilder.cs
  type IPipelineAsyncBuilder (line 10) | public interface IPipelineAsyncBuilder<TRequest> : IPipelineAsyncBuilder
    method Call (line 18) | IPipelineAsyncBuilder<TRequest> Call<THandler>(Func<THandler, TRequest...
    method Return (line 27) | IPipelineAsync Return<TResult, THandler>(Func<THandler, TRequest, Task...
    method Build (line 39) | IPipelineAsync Build();
  type IPipelineAsyncBuilder (line 33) | public interface IPipelineAsyncBuilder
    method Call (line 18) | IPipelineAsyncBuilder<TRequest> Call<THandler>(Func<THandler, TRequest...
    method Return (line 27) | IPipelineAsync Return<TResult, THandler>(Func<THandler, TRequest, Task...
    method Build (line 39) | IPipelineAsync Build();

FILE: src/FluentMediator/Pipelines/PipelineAsync/Pipeline.cs
  class Pipeline (line 6) | internal sealed class Pipeline : IPipelineAsync
    method Pipeline (line 11) | public Pipeline(IMethodCollection<Method<Func<object, object, Task>>> ...
    method PublishAsync (line 22) | public async Task PublishAsync(GetService getService, object request)
    method SendAsync (line 31) | public async Task<TResult> SendAsync<TResult>(GetService getService, o...

FILE: src/FluentMediator/Pipelines/PipelineAsync/PipelineBuilder.cs
  class PipelineBuilder (line 6) | internal sealed class PipelineBuilder<TRequest> : IPipelineAsyncBuilder<...
    method PipelineBuilder (line 12) | public PipelineBuilder(string? name)
    method Call (line 18) | public IPipelineAsyncBuilder<TRequest> Call<THandler>(Func<THandler, T...
    method Return (line 26) | public IPipelineAsync Return<TResult, THandler>(Func<THandler, TReques...
    method Build (line 32) | public IPipelineAsync Build()

FILE: src/FluentMediator/Pipelines/PipelineBehavior.cs
  class PipelineBehavior (line 7) | internal sealed class PipelineBehavior<TRequest> : IPipelineBehavior<TRe...
    method PipelineBehavior (line 11) | public PipelineBehavior(IPipelineProviderBuilder pipelineProviderBuilder)
    method Pipeline (line 16) | public IPipelineBuilder<TRequest> Pipeline(string? pipelineName = null)
    method PipelineAsync (line 23) | public IPipelineAsyncBuilder<TRequest> PipelineAsync(string? pipelineN...
    method CancellablePipelineAsync (line 30) | public ICancellablePipelineAsyncBuilder<TRequest> CancellablePipelineA...

FILE: src/FluentMediator/Pipelines/PipelineCollection.cs
  class PipelineCollection (line 6) | internal sealed class PipelineCollection<TPipeline> : IPipelineCollectio...
    method PipelineCollection (line 12) | public PipelineCollection()
    method Add (line 18) | public void Add(TPipeline pipeline)
    method Get (line 34) | public TPipeline Get(Type requestType)
    method Get (line 44) | public TPipeline Get(string pipelineName)

FILE: src/FluentMediator/Pipelines/PipelineNotFoundException.cs
  class PipelineNotFoundException (line 6) | internal sealed class PipelineNotFoundException : MediatorException
    method PipelineNotFoundException (line 13) | public PipelineNotFoundException(string message) : base(message) { }

FILE: src/FluentMediator/Pipelines/ReturnFunctionIsNullException.cs
  class ReturnFunctionIsNullException (line 6) | public sealed class ReturnFunctionIsNullException : MediatorException
    method ReturnFunctionIsNullException (line 13) | public ReturnFunctionIsNullException(string message) : base(message) { }

FILE: test/UnitTests/BuildingMediatorTests.cs
  class BuildingMediatorTests (line 10) | public class BuildingMediatorTests
    method BuildSendAsyncPipeline_ThrowsPipelineAlreadyExistsException (line 12) | [Fact]

FILE: test/UnitTests/MyCustomMediator.cs
  class MyCustomMediator (line 5) | public class MyCustomMediator : Mediator
    method MyCustomMediator (line 9) | public MyCustomMediator(GetService getService, IPipelineProvider pipel...
    method OnPipelineNotFound (line 12) | protected override void OnPipelineNotFound(PipelineNotFoundEventArgs e)

FILE: test/UnitTests/PingPong/IPingHandler.cs
  type IPingHandler (line 6) | public interface IPingHandler
    method MyCustomFooMethod (line 8) | PingResponse MyCustomFooMethod(PingRequest request);
    method MyCustomBarMethod (line 9) | PingResponse MyCustomBarMethod(PingRequest request);
    method MyCustomFooBarAsync (line 10) | Task<PingResponse> MyCustomFooBarAsync(PingRequest request);
    method MyCancellableForAsync (line 11) | Task<PingResponse> MyCancellableForAsync(PingRequest request, Cancella...

FILE: test/UnitTests/PingPong/PingHandler.cs
  class PingHandler (line 6) | public class PingHandler : IPingHandler
    method MyCustomBarMethod (line 8) | public PingResponse MyCustomBarMethod(PingRequest request)
    method MyCustomFooMethod (line 13) | public PingResponse MyCustomFooMethod(PingRequest request)
    method MyCustomFooBarAsync (line 18) | public Task<PingResponse> MyCustomFooBarAsync(PingRequest request)
    method MyCancellableForAsync (line 23) | public Task<PingResponse> MyCancellableForAsync(PingRequest request, C...

FILE: test/UnitTests/PingPong/PingRequest.cs
  class PingRequest (line 3) | public class PingRequest
    method PingRequest (line 7) | public PingRequest(string message)

FILE: test/UnitTests/PingPong/PingResponse.cs
  class PingResponse (line 3) | public class PingResponse
    method PingResponse (line 7) | public PingResponse(string message)

FILE: test/UnitTests/PublishingRequestsTests.cs
  class PublishingRequestsTests (line 11) | public sealed class PublishingRequestsTests
    method Publish_Calls_Pipeline_Handlers (line 13) | [Fact]
    method PublishAsync_Calls_AsyncPipeline_Handlers (line 40) | [Fact]
    method PublishAsync_Calls_CancellablePipeline_Handlers (line 66) | [Fact]
    method PublishAsync_Calls_CancellablePipeline_Handlers2 (line 94) | [Fact]
    method Publish_CallsPipelineNotFound_WhenHandlerIsNotSetup (line 123) | [Fact]
    method Publish_CallsCustomPipelineNotFound_WhenHandlerIsNotSetup (line 151) | [Fact]

FILE: test/UnitTests/SendingRequestTests.cs
  class SendingRequestTests (line 12) | public class SendingRequestTests
    method Send_Without_Return_Throws_ReturnFunctionIsNullException (line 14) | [Fact]
    method SendAsync_Without_Return_Throws_ReturnFunctionIsNullException (line 42) | [Fact]
    method CancellableSendAsync_Without_Return_Throws_ReturnFunctionIsNullException (line 73) | [Fact]
    method SendAsync_Returns_Response (line 102) | [Fact]
    method Send_Returns_Response (line 123) | [Fact]
    method Send_Named_PipelineReturns_Response (line 146) | [Fact]
    method Send_Named_PipelineAsync_Returns_Response (line 174) | [Fact]
    method SendCancellable_Named_PipelineReturns_Response (line 202) | [Fact]
    method Send_Throws_Exception_Null_Requests (line 231) | [Fact]
Condensed preview — 103 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (160K chars).
[
  {
    "path": ".all-contributorsrc",
    "chars": 1038,
    "preview": "{\n  \"files\": [\n    \"README.md\"\n  ],\n  \"imageSize\": 100,\n  \"commit\": false,\n  \"contributors\": [\n    {\n      \"login\": \"iva"
  },
  {
    "path": ".editorconfig",
    "chars": 7569,
    "preview": "# editorconfig.org\n\n# top-most EditorConfig file\nroot = true\n\n# Default settings:\n# A newline ending every file\n# Use 4 "
  },
  {
    "path": ".gitignore",
    "chars": 5593,
    "preview": "## Ignore Visual Studio temporary files, build results, and\n## files generated by popular Visual Studio add-ons.\n##\n## G"
  },
  {
    "path": ".vscode/launch.json",
    "chars": 1113,
    "preview": "{\n   // Use IntelliSense to find out which attributes exist for C# debugging\n   // Use hover for the description of the "
  },
  {
    "path": ".vscode/settings.json",
    "chars": 709,
    "preview": "{\n    \"workbench.colorCustomizations\": {\n        \"activityBar.background\": \"#2f7c47\",\n        \"activityBar.activeBorder\""
  },
  {
    "path": ".vscode/tasks.json",
    "chars": 1259,
    "preview": "{\n    \"version\": \"2.0.0\",\n    \"tasks\": [\n        {\n            \"label\": \"build\",\n            \"command\": \"dotnet\",\n      "
  },
  {
    "path": "FluentMediator.sln",
    "chars": 4680,
    "preview": "\r\nMicrosoft Visual Studio Solution File, Format Version 12.00\r\n# Visual Studio 15\r\nVisualStudioVersion = 15.0.26124.0\r\n"
  },
  {
    "path": "LICENSE",
    "chars": 11357,
    "preview": "                                 Apache License\n                           Version 2.0, January 2004\n                   "
  },
  {
    "path": "README.md",
    "chars": 3949,
    "preview": "# FluentMediator\n[![Build Status](https://ivanpaulovich.visualstudio.com/FluentMediator/_apis/build/status/ivanpaulovich"
  },
  {
    "path": "azure-pipelines-1.yml",
    "chars": 1754,
    "preview": "# ASP.NET Core (.NET Framework)\n# Build and test ASP.NET Core projects targeting the full .NET Framework.\n# Add steps th"
  },
  {
    "path": "azure-pipelines.yml",
    "chars": 1008,
    "preview": "# ASP.NET Core (.NET Framework)\n# Build and test ASP.NET Core projects targeting the full .NET Framework.\n# Add steps th"
  },
  {
    "path": "changelog.md",
    "chars": 1172,
    "preview": "# Change Log\n\n## 2020-02-04 - 0.4.7\n\n- #48 Changed `PipelineNotFoundException` to internal.\n- #48 Removed sealed modifie"
  },
  {
    "path": "samples/AspNetCore/.vscode/launch.json",
    "chars": 1458,
    "preview": "{\n   // Use IntelliSense to find out which attributes exist for C# debugging\n   // Use hover for the description of the "
  },
  {
    "path": "samples/AspNetCore/.vscode/tasks.json",
    "chars": 1238,
    "preview": "{\n    \"version\": \"2.0.0\",\n    \"tasks\": [\n        {\n            \"label\": \"build\",\n            \"command\": \"dotnet\",\n      "
  },
  {
    "path": "samples/AspNetCore/Wallet.sln",
    "chars": 5718,
    "preview": "\r\nMicrosoft Visual Studio Solution File, Format Version 12.00\r\n# Visual Studio 15\r\nVisualStudioVersion = 15.0.26124.0\r\n"
  },
  {
    "path": "samples/AspNetCore/src/Core/Core.csproj",
    "chars": 330,
    "preview": "<Project Sdk=\"Microsoft.NET.Sdk\">\r\n\r\n  <PropertyGroup>\r\n    <TargetFramework>netstandard2.1</TargetFramework>\r\n    <Null"
  },
  {
    "path": "samples/AspNetCore/src/Core/Services/ICustomerRepository.cs",
    "chars": 137,
    "preview": "using Core.Wallet;\n\nnamespace Core.Services\n{\n    public interface ICustomerRepository\n    {\n        void Add(Customer c"
  },
  {
    "path": "samples/AspNetCore/src/Core/UseCases/IRegisterUseCase.cs",
    "chars": 144,
    "preview": "namespace Core.UseCases\n{\n    public interface IRegisterUseCase\n    {\n        RegisterResponse Execute(RegisterCommand r"
  },
  {
    "path": "samples/AspNetCore/src/Core/UseCases/Register.cs",
    "chars": 698,
    "preview": "using Core.Services;\nusing Core.Wallet;\n\nnamespace Core.UseCases\n{\n    public class Register : IRegisterUseCase\n    {\n  "
  },
  {
    "path": "samples/AspNetCore/src/Core/UseCases/RegisterCommand.cs",
    "chars": 395,
    "preview": "namespace Core.UseCases\n{\n    public class RegisterCommand\n    {\n        public string Name { get; private set; }\n      "
  },
  {
    "path": "samples/AspNetCore/src/Core/UseCases/RegisterResponse.cs",
    "chars": 232,
    "preview": "using System;\n\nnamespace Core.UseCases\n{\n    public class RegisterResponse\n    {\n        public Guid UserId { get; priva"
  },
  {
    "path": "samples/AspNetCore/src/Core/Wallet/Customer.cs",
    "chars": 576,
    "preview": "using System;\n\nnamespace Core.Wallet\n{\n    public class Customer\n    {\n        public Guid Id { get; protected set; }\n  "
  },
  {
    "path": "samples/AspNetCore/src/Infrastructure/InMemory/CustomerRepository.cs",
    "chars": 436,
    "preview": "using System.Collections.Generic;\nusing Core.Services;\nusing Core.Wallet;\n\nnamespace Infrastructure.InMemory\n{\n    publi"
  },
  {
    "path": "samples/AspNetCore/src/Infrastructure/Infrastructure.csproj",
    "chars": 421,
    "preview": "<Project Sdk=\"Microsoft.NET.Sdk\">\r\n\r\n  <PropertyGroup>\r\n    <TargetFramework>netstandard2.1</TargetFramework>\r\n    <Null"
  },
  {
    "path": "samples/AspNetCore/src/WebApi/Controllers/Register/CustomersController.cs",
    "chars": 830,
    "preview": "using System.ComponentModel.DataAnnotations;\nusing Core.UseCases;\nusing FluentMediator;\nusing Microsoft.AspNetCore.Mvc;\n"
  },
  {
    "path": "samples/AspNetCore/src/WebApi/Controllers/Register/RegisterRequest.cs",
    "chars": 212,
    "preview": "namespace WebApi.Controllers.Register\n{\n    public class RegisterRequest\n    {\n        public string Name { get; set; }\n"
  },
  {
    "path": "samples/AspNetCore/src/WebApi/Program.cs",
    "chars": 671,
    "preview": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Threading.Tasks;\nusing Microsoft.AspNetC"
  },
  {
    "path": "samples/AspNetCore/src/WebApi/Startup.cs",
    "chars": 1945,
    "preview": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Threading;\nusing System.Threading.Tasks;"
  },
  {
    "path": "samples/AspNetCore/src/WebApi/WebApi.csproj",
    "chars": 670,
    "preview": "<Project Sdk=\"Microsoft.NET.Sdk.Web\">\r\n\r\n  <PropertyGroup>\r\n    <TargetFramework>netcoreapp3.0</TargetFramework>\r\n    <A"
  },
  {
    "path": "samples/AspNetCore/src/WebApi/appsettings.Development.json",
    "chars": 146,
    "preview": "{\r\n  \"Logging\": {\r\n    \"LogLevel\": {\r\n      \"Default\": \"Debug\",\r\n      \"System\": \"Information\",\r\n      \"Microsoft\": \"Inf"
  },
  {
    "path": "samples/AspNetCore/src/WebApi/appsettings.json",
    "chars": 192,
    "preview": "{\r\n  \"Logging\": {\r\n    \"LogLevel\": {\r\n      \"Default\": \"Information\",\r\n      \"Microsoft\": \"Warning\",\r\n      \"Microsoft.H"
  },
  {
    "path": "samples/AspNetCore/test/UnitTests/UnitTests.csproj",
    "chars": 953,
    "preview": "<Project Sdk=\"Microsoft.NET.Sdk\">\r\n\r\n  <PropertyGroup>\r\n    <TargetFramework>netcoreapp3.0</TargetFramework>\r\n    <IsPac"
  },
  {
    "path": "samples/AspNetCore/test/UnitTests/UseCasesTests/RegisterTests.cs",
    "chars": 708,
    "preview": "using Core.UseCases;\nusing Infrastructure.InMemory;\nusing Xunit;\n\nnamespace UnitTests.UseCasesTests\n{\n    public class R"
  },
  {
    "path": "samples/SimpleConsoleApp/.vscode/launch.json",
    "chars": 1100,
    "preview": "{\n   // Use IntelliSense to find out which attributes exist for C# debugging\n   // Use hover for the description of the "
  },
  {
    "path": "samples/SimpleConsoleApp/.vscode/settings.json",
    "chars": 662,
    "preview": "{\n    \"workbench.colorCustomizations\": {\n        \"activityBar.background\": \"#1f6fd0\",\n        \"activityBar.foreground\": "
  },
  {
    "path": "samples/SimpleConsoleApp/.vscode/tasks.json",
    "chars": 1238,
    "preview": "{\n    \"version\": \"2.0.0\",\n    \"tasks\": [\n        {\n            \"label\": \"build\",\n            \"command\": \"dotnet\",\n      "
  },
  {
    "path": "samples/SimpleConsoleApp/PingPong/PingHandler.cs",
    "chars": 833,
    "preview": "using System;\nusing System.Threading;\nusing System.Threading.Tasks;\n\nnamespace PingPong\n{\n    public class PingHandler\n "
  },
  {
    "path": "samples/SimpleConsoleApp/PingPong/PingPong.csproj",
    "chars": 591,
    "preview": "<Project Sdk=\"Microsoft.NET.Sdk\">\r\n\r\n  <PropertyGroup>\r\n    <OutputType>Exe</OutputType>\r\n    <TargetFramework>netcoreap"
  },
  {
    "path": "samples/SimpleConsoleApp/PingPong/PingRequest.cs",
    "chars": 197,
    "preview": "namespace PingPong\n{\n    public class PingRequest\n    {\n        public string Message { get; }\n\n        public PingReque"
  },
  {
    "path": "samples/SimpleConsoleApp/PingPong/Program.cs",
    "chars": 1717,
    "preview": "using System;\nusing System.Threading;\nusing FluentMediator;\nusing Microsoft.Extensions.DependencyInjection;\n\nnamespace P"
  },
  {
    "path": "samples/SimpleConsoleApp/Samples.sln",
    "chars": 1729,
    "preview": "\r\nMicrosoft Visual Studio Solution File, Format Version 12.00\r\n# Visual Studio 15\r\nVisualStudioVersion = 15.0.26124.0\r\n"
  },
  {
    "path": "src/FluentMediator/FluentMediator.csproj",
    "chars": 1918,
    "preview": "<Project Sdk=\"Microsoft.NET.Sdk\">\r\n\r\n  <PropertyGroup>\r\n    <TargetFramework>netstandard1.1</TargetFramework>\r\n    <Null"
  },
  {
    "path": "src/FluentMediator/GetService.cs",
    "chars": 263,
    "preview": "using System;\n\nnamespace FluentMediator\n{\n    /// <summary>\n    /// Retrieves a Handler Service from the Container\n    /"
  },
  {
    "path": "src/FluentMediator/IMediator.cs",
    "chars": 591,
    "preview": "using System;\nusing FluentMediator.Pipelines.CancellablePipelineAsync;\nusing FluentMediator.Pipelines.Pipeline;\nusing Fl"
  },
  {
    "path": "src/FluentMediator/IPipelineProvider.cs",
    "chars": 406,
    "preview": "using FluentMediator.Pipelines.CancellablePipelineAsync;\nusing FluentMediator.Pipelines.Pipeline;\nusing FluentMediator.P"
  },
  {
    "path": "src/FluentMediator/IPipelineProviderBuilder.cs",
    "chars": 983,
    "preview": "using FluentMediator.Pipelines;\nusing FluentMediator.Pipelines.CancellablePipelineAsync;\nusing FluentMediator.Pipelines."
  },
  {
    "path": "src/FluentMediator/Mediator.cs",
    "chars": 7714,
    "preview": "using System;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing FluentMediator.Pipelines;\n\nnamespace FluentMed"
  },
  {
    "path": "src/FluentMediator/MediatorException.cs",
    "chars": 476,
    "preview": "using System;\n\nnamespace FluentMediator\n{\n    /// <summary>\n    /// All Exceptions from FluentMediator are derived from "
  },
  {
    "path": "src/FluentMediator/NullRequestException.cs",
    "chars": 436,
    "preview": "namespace FluentMediator\n{\n    /// <summary>\n    /// Occurs when the message is null\n    /// </summary>\n    public class"
  },
  {
    "path": "src/FluentMediator/PipelineNotFoundEventArgs.cs",
    "chars": 511,
    "preview": "using System;\n\nnamespace FluentMediator\n{\n    /// <summary>\n    /// On Error Event.\n    /// </summary>\n    public class "
  },
  {
    "path": "src/FluentMediator/PipelineProvider.cs",
    "chars": 3423,
    "preview": "using System;\nusing FluentMediator.Pipelines;\nusing FluentMediator.Pipelines.CancellablePipelineAsync;\nusing FluentMedia"
  },
  {
    "path": "src/FluentMediator/PipelineProviderBuilder.cs",
    "chars": 3941,
    "preview": "using System.Collections.Generic;\nusing System.Collections.ObjectModel;\nusing FluentMediator.Pipelines;\nusing FluentMedi"
  },
  {
    "path": "src/FluentMediator/Pipelines/CancellablePipelineAsync/Direct.cs",
    "chars": 1229,
    "preview": "using System;\nusing System.Threading;\nusing System.Threading.Tasks;\n\nnamespace FluentMediator.Pipelines.CancellablePipel"
  },
  {
    "path": "src/FluentMediator/Pipelines/CancellablePipelineAsync/ICancellableMediator.cs",
    "chars": 1127,
    "preview": "using System.Threading;\nusing System.Threading.Tasks;\n\nnamespace FluentMediator.Pipelines.CancellablePipelineAsync\n{\n   "
  },
  {
    "path": "src/FluentMediator/Pipelines/CancellablePipelineAsync/ICancellablePipelineAsync.cs",
    "chars": 1228,
    "preview": "using System.Threading;\nusing System.Threading.Tasks;\n\nnamespace FluentMediator.Pipelines.CancellablePipelineAsync\n{\n   "
  },
  {
    "path": "src/FluentMediator/Pipelines/CancellablePipelineAsync/ICancellablePipelineAsyncBuilder.cs",
    "chars": 1268,
    "preview": "using System;\nusing System.Threading;\nusing System.Threading.Tasks;\n\nnamespace FluentMediator.Pipelines.CancellablePipel"
  },
  {
    "path": "src/FluentMediator/Pipelines/CancellablePipelineAsync/ICancellablePipelineProvider.cs",
    "chars": 617,
    "preview": "using System;\n\nnamespace FluentMediator.Pipelines.CancellablePipelineAsync\n{\n    /// <summary>\n    /// \n    /// </summar"
  },
  {
    "path": "src/FluentMediator/Pipelines/CancellablePipelineAsync/ICancellablePipelineProviderBuilder.cs",
    "chars": 415,
    "preview": "namespace FluentMediator.Pipelines.CancellablePipelineAsync\n{\n    /// <summary>\n    /// \n    /// </summary>\n    public i"
  },
  {
    "path": "src/FluentMediator/Pipelines/CancellablePipelineAsync/IDirect.cs",
    "chars": 325,
    "preview": "using System.Threading;\nusing System.Threading.Tasks;\n\nnamespace FluentMediator.Pipelines.CancellablePipelineAsync\n{\n   "
  },
  {
    "path": "src/FluentMediator/Pipelines/CancellablePipelineAsync/Pipeline.cs",
    "chars": 2029,
    "preview": "using System;\nusing System.Threading;\nusing System.Threading.Tasks;\n\nnamespace FluentMediator.Pipelines.CancellablePipel"
  },
  {
    "path": "src/FluentMediator/Pipelines/CancellablePipelineAsync/PipelineBuilder.cs",
    "chars": 1457,
    "preview": "using System;\nusing System.Threading;\nusing System.Threading.Tasks;\n\nnamespace FluentMediator.Pipelines.CancellablePipel"
  },
  {
    "path": "src/FluentMediator/Pipelines/IMethodCollection.cs",
    "chars": 220,
    "preview": "using System.Collections.ObjectModel;\n\nnamespace FluentMediator.Pipelines\n{\n    internal interface IMethodCollection<Met"
  },
  {
    "path": "src/FluentMediator/Pipelines/INamedPipeline.cs",
    "chars": 289,
    "preview": "namespace FluentMediator.Pipelines\n{\n    /// <summary>\n    /// Named Pipeline\n    /// </summary>\n    public interface IN"
  },
  {
    "path": "src/FluentMediator/Pipelines/IPipelineBehavior.cs",
    "chars": 1270,
    "preview": "using FluentMediator.Pipelines.CancellablePipelineAsync;\nusing FluentMediator.Pipelines.Pipeline;\nusing FluentMediator.P"
  },
  {
    "path": "src/FluentMediator/Pipelines/IPipelineCollection.cs",
    "chars": 282,
    "preview": "using System;\n\nnamespace FluentMediator.Pipelines\n{\n    internal interface IPipelineCollection<TPipeline> where TPipelin"
  },
  {
    "path": "src/FluentMediator/Pipelines/ITypedPipeline.cs",
    "chars": 296,
    "preview": "using System;\n\nnamespace FluentMediator.Pipelines\n{\n    /// <summary>\n    /// A Typed Pipeline\n    /// </summary>\n    pu"
  },
  {
    "path": "src/FluentMediator/Pipelines/Method.cs",
    "chars": 332,
    "preview": "using System;\n\nnamespace FluentMediator.Pipelines\n{\n    internal sealed class Method<TAction>\n    {\n        public Type "
  },
  {
    "path": "src/FluentMediator/Pipelines/MethodCollection.cs",
    "chars": 600,
    "preview": "using System.Collections.Generic;\nusing System.Collections.ObjectModel;\n\nnamespace FluentMediator.Pipelines\n{\n    intern"
  },
  {
    "path": "src/FluentMediator/Pipelines/Pipeline/Direct.cs",
    "chars": 781,
    "preview": "using System;\n\nnamespace FluentMediator.Pipelines.Pipeline\n{\n    internal sealed class Direct<TRequest, TResult, THandle"
  },
  {
    "path": "src/FluentMediator/Pipelines/Pipeline/IDirect.cs",
    "chars": 194,
    "preview": "namespace FluentMediator.Pipelines.Pipeline\n{\n    internal interface IDirect\n    {\n        TResult Send<TResult>(\n      "
  },
  {
    "path": "src/FluentMediator/Pipelines/Pipeline/IPipeline.cs",
    "chars": 678,
    "preview": "namespace FluentMediator.Pipelines.Pipeline\n{\n    /// <summary>\n    /// \n    /// </summary>\n    public interface IPipeli"
  },
  {
    "path": "src/FluentMediator/Pipelines/Pipeline/IPipelineBuilder.cs",
    "chars": 1038,
    "preview": "using System;\n\nnamespace FluentMediator.Pipelines.Pipeline\n{\n    /// <summary>\n    /// \n    /// </summary>\n    /// <type"
  },
  {
    "path": "src/FluentMediator/Pipelines/Pipeline/ISyncMediator.cs",
    "chars": 665,
    "preview": "namespace FluentMediator.Pipelines.Pipeline\n{\n    /// <summary>\n    /// \n    /// </summary>\n    public interface ISyncMe"
  },
  {
    "path": "src/FluentMediator/Pipelines/Pipeline/ISyncPipelineProvider.cs",
    "chars": 540,
    "preview": "using System;\n\nnamespace FluentMediator.Pipelines.Pipeline\n{\n    /// <summary>\n    /// \n    /// </summary>\n    public in"
  },
  {
    "path": "src/FluentMediator/Pipelines/Pipeline/ISyncPipelineProviderBuilder.cs",
    "chars": 360,
    "preview": "namespace FluentMediator.Pipelines.Pipeline\n{\n    /// <summary>\n    /// \n    /// </summary>\n    public interface ISyncPi"
  },
  {
    "path": "src/FluentMediator/Pipelines/Pipeline/Pipeline.cs",
    "chars": 1477,
    "preview": "using System;\n\nnamespace FluentMediator.Pipelines.Pipeline\n{\n    internal sealed class Pipeline : IPipeline\n    {\n      "
  },
  {
    "path": "src/FluentMediator/Pipelines/Pipeline/PipelineBuilder.cs",
    "chars": 1177,
    "preview": "using System;\n\nnamespace FluentMediator.Pipelines.Pipeline\n{\n    internal sealed class PipelineBuilder<TRequest> : IPipe"
  },
  {
    "path": "src/FluentMediator/Pipelines/PipelineAlreadyExistsException.cs",
    "chars": 508,
    "preview": "namespace FluentMediator.Pipelines\n{\n    /// <summary>\n    /// Occurs when pipelines have the same name\n    /// </summar"
  },
  {
    "path": "src/FluentMediator/Pipelines/PipelineAsync/Direct.cs",
    "chars": 1027,
    "preview": "using System;\nusing System.Threading.Tasks;\n\nnamespace FluentMediator.Pipelines.PipelineAsync\n{\n    internal sealed clas"
  },
  {
    "path": "src/FluentMediator/Pipelines/PipelineAsync/IAsyncMediator.cs",
    "chars": 750,
    "preview": "using System.Threading.Tasks;\n\nnamespace FluentMediator.Pipelines.PipelineAsync\n{\n    /// <summary>\n    /// \n    /// </s"
  },
  {
    "path": "src/FluentMediator/Pipelines/PipelineAsync/IAsyncPipelineProvider.cs",
    "chars": 566,
    "preview": "using System;\n\nnamespace FluentMediator.Pipelines.PipelineAsync\n{\n    /// <summary>\n    /// \n    /// </summary>\n    publ"
  },
  {
    "path": "src/FluentMediator/Pipelines/PipelineAsync/IAsyncPipelineProviderBuilder.cs",
    "chars": 376,
    "preview": "namespace FluentMediator.Pipelines.PipelineAsync\n{\n    /// <summary>\n    /// \n    /// </summary>\n    public interface IA"
  },
  {
    "path": "src/FluentMediator/Pipelines/PipelineAsync/IDirect.cs",
    "chars": 241,
    "preview": "using System.Threading.Tasks;\n\nnamespace FluentMediator.Pipelines.PipelineAsync\n{\n    internal interface IDirect\n    {\n "
  },
  {
    "path": "src/FluentMediator/Pipelines/PipelineAsync/IPipelineAsync.cs",
    "chars": 767,
    "preview": "using System.Threading.Tasks;\n\nnamespace FluentMediator.Pipelines.PipelineAsync\n{\n    /// <summary>\n    /// \n    /// </s"
  },
  {
    "path": "src/FluentMediator/Pipelines/PipelineAsync/IPipelineAsyncBuilder.cs",
    "chars": 1109,
    "preview": "using System;\nusing System.Threading.Tasks;\n\nnamespace FluentMediator.Pipelines.PipelineAsync\n{\n    /// <summary>\n    //"
  },
  {
    "path": "src/FluentMediator/Pipelines/PipelineAsync/Pipeline.cs",
    "chars": 1581,
    "preview": "using System;\nusing System.Threading.Tasks;\n\nnamespace FluentMediator.Pipelines.PipelineAsync\n{\n    internal sealed clas"
  },
  {
    "path": "src/FluentMediator/Pipelines/PipelineAsync/PipelineBuilder.cs",
    "chars": 1265,
    "preview": "using System;\nusing System.Threading.Tasks;\n\nnamespace FluentMediator.Pipelines.PipelineAsync\n{\n    internal sealed clas"
  },
  {
    "path": "src/FluentMediator/Pipelines/PipelineBehavior.cs",
    "chars": 1436,
    "preview": "using FluentMediator.Pipelines.CancellablePipelineAsync;\nusing FluentMediator.Pipelines.Pipeline;\nusing FluentMediator.P"
  },
  {
    "path": "src/FluentMediator/Pipelines/PipelineCollection.cs",
    "chars": 1929,
    "preview": "using System;\nusing System.Collections.Generic;\n\nnamespace FluentMediator.Pipelines\n{\n    internal sealed class Pipeline"
  },
  {
    "path": "src/FluentMediator/Pipelines/PipelineNotFoundException.cs",
    "chars": 503,
    "preview": "namespace FluentMediator.Pipelines\n{\n    /// <summary>\n    /// Occurs when a pipeline for a message was not found\n    //"
  },
  {
    "path": "src/FluentMediator/Pipelines/ReturnFunctionIsNullException.cs",
    "chars": 483,
    "preview": "namespace FluentMediator.Pipelines\n{\n    /// <summary>\n    /// Occurs when a return function was not defined\n    /// </s"
  },
  {
    "path": "src/FluentMediator.Microsoft.Extensions.DependencyInjection/FluentMediator.Microsoft.Extensions.DependencyInjection.csproj",
    "chars": 1848,
    "preview": "<Project Sdk=\"Microsoft.NET.Sdk\">\r\n\r\n  <PropertyGroup>\r\n    <TargetFramework>netstandard1.1</TargetFramework>\r\n    <Docu"
  },
  {
    "path": "src/FluentMediator.Microsoft.Extensions.DependencyInjection/FluentMediatorExtensions.cs",
    "chars": 3658,
    "preview": "using System;\nusing Microsoft.Extensions.DependencyInjection;\n\nnamespace FluentMediator\n{\n    /// <summary>\n    /// Flue"
  },
  {
    "path": "test/UnitTests/BuildingMediatorTests.cs",
    "chars": 1082,
    "preview": "using System;\nusing FluentMediator;\nusing FluentMediator.Pipelines;\nusing Microsoft.Extensions.DependencyInjection;\nusin"
  },
  {
    "path": "test/UnitTests/MyCustomMediator.cs",
    "chars": 607,
    "preview": "using FluentMediator;\n\nnamespace UnitTests\n{\n    public class MyCustomMediator : Mediator\n    {\n        public bool MyCu"
  },
  {
    "path": "test/UnitTests/PingPong/IPingHandler.cs",
    "chars": 431,
    "preview": "using System.Threading;\nusing System.Threading.Tasks;\n\nnamespace UnitTests.PingPong\n{\n    public interface IPingHandler\n"
  },
  {
    "path": "test/UnitTests/PingPong/PingHandler.cs",
    "chars": 762,
    "preview": "using System.Threading;\nusing System.Threading.Tasks;\n\nnamespace UnitTests.PingPong\n{\n    public class PingHandler : IPi"
  },
  {
    "path": "test/UnitTests/PingPong/PingRequest.cs",
    "chars": 207,
    "preview": "namespace UnitTests.PingPong\n{\n    public class PingRequest\n    {\n        public string Message { get; }\n\n        public"
  },
  {
    "path": "test/UnitTests/PingPong/PingResponse.cs",
    "chars": 209,
    "preview": "namespace UnitTests.PingPong\n{\n    public class PingResponse\n    {\n        public string Message { get; }\n\n        publi"
  },
  {
    "path": "test/UnitTests/PublishingRequestsTests.cs",
    "chars": 6253,
    "preview": "using System.Threading;\nusing System.Threading.Tasks;\nusing FluentMediator;\nusing Microsoft.Extensions.DependencyInjecti"
  },
  {
    "path": "test/UnitTests/SendingRequestTests.cs",
    "chars": 9042,
    "preview": "using System.Threading;\nusing System.Threading.Tasks;\nusing FluentMediator;\nusing FluentMediator.Pipelines;\nusing Micros"
  },
  {
    "path": "test/UnitTests/UnitTests.csproj",
    "chars": 1079,
    "preview": "<Project Sdk=\"Microsoft.NET.Sdk\">\r\n\r\n  <PropertyGroup>\r\n    <TargetFramework>netcoreapp2.2</TargetFramework>\r\n    <IsPac"
  }
]

// ... and 1 more files (download for full content)

About this extraction

This page contains the full source code of the ivanpaulovich/FluentMediator GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 103 files (142.2 KB), approximately 37.4k tokens, and a symbol index with 239 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!