diff --git a/.github/workflows/publish-nuget.yml b/.github/workflows/publish-nuget.yml
index 7cb4da3..076a206 100644
--- a/.github/workflows/publish-nuget.yml
+++ b/.github/workflows/publish-nuget.yml
@@ -29,12 +29,7 @@ jobs:
run: dotnet build KSFramework.sln --configuration Release --no-restore
- name: Pack NuGet
- run: dotnet pack src/KSFramework/KSFramework.csproj \
- --configuration Release \
- -p:PackageVersion=${{ env.PACKAGE_VERSION }} \
- --no-build -o out
+ run: dotnet pack src/KSFramework/KSFramework.csproj --configuration Release -p:PackageVersion=${{ env.PACKAGE_VERSION }} --no-build -o out
- name: Push to NuGet
- run: dotnet nuget push out/*.nupkg \
- --api-key ${{ secrets.NUGET_API_KEY }} \
- --source https://api.nuget.org/v3/index.json
+ run: dotnet nuget push out/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json
diff --git a/KSFramework.sln b/KSFramework.sln
index 37d31fa..4a7b249 100644
--- a/KSFramework.sln
+++ b/KSFramework.sln
@@ -7,6 +7,18 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{827E0CD3-B72
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KSFramework", "src\KSFramework\KSFramework.csproj", "{B335BD79-05C0-4F0E-A2DA-FC72DF07A18C}"
EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Samples", "Samples", "{5D20AA90-6969-D8BD-9DCD-8634F4692FDA}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "MediatorSampleApp", "MediatorSampleApp", "{B36C9166-6687-1700-0084-D88BD073518A}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mediator", "Samples\MediatorSampleApp\Mediator.csproj", "{D849CD75-73AE-4F1A-80EA-0FC596C80723}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{0AB3BF05-4346-4AA6-1389-037BE0695223}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "KSFramework", "KSFramework", "{6F746C7E-99E8-D040-B792-CDA2514E83CE}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KSFramework.UnitTests", "tests\KSFramework\KSFramework.UnitTests\KSFramework.UnitTests.csproj", "{48D1B7B2-D99B-4554-BBFB-95E75720B8E5}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -29,11 +41,39 @@ Global
{B335BD79-05C0-4F0E-A2DA-FC72DF07A18C}.Release|x64.Build.0 = Release|Any CPU
{B335BD79-05C0-4F0E-A2DA-FC72DF07A18C}.Release|x86.ActiveCfg = Release|Any CPU
{B335BD79-05C0-4F0E-A2DA-FC72DF07A18C}.Release|x86.Build.0 = Release|Any CPU
+ {D849CD75-73AE-4F1A-80EA-0FC596C80723}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {D849CD75-73AE-4F1A-80EA-0FC596C80723}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {D849CD75-73AE-4F1A-80EA-0FC596C80723}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {D849CD75-73AE-4F1A-80EA-0FC596C80723}.Debug|x64.Build.0 = Debug|Any CPU
+ {D849CD75-73AE-4F1A-80EA-0FC596C80723}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {D849CD75-73AE-4F1A-80EA-0FC596C80723}.Debug|x86.Build.0 = Debug|Any CPU
+ {D849CD75-73AE-4F1A-80EA-0FC596C80723}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {D849CD75-73AE-4F1A-80EA-0FC596C80723}.Release|Any CPU.Build.0 = Release|Any CPU
+ {D849CD75-73AE-4F1A-80EA-0FC596C80723}.Release|x64.ActiveCfg = Release|Any CPU
+ {D849CD75-73AE-4F1A-80EA-0FC596C80723}.Release|x64.Build.0 = Release|Any CPU
+ {D849CD75-73AE-4F1A-80EA-0FC596C80723}.Release|x86.ActiveCfg = Release|Any CPU
+ {D849CD75-73AE-4F1A-80EA-0FC596C80723}.Release|x86.Build.0 = Release|Any CPU
+ {48D1B7B2-D99B-4554-BBFB-95E75720B8E5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {48D1B7B2-D99B-4554-BBFB-95E75720B8E5}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {48D1B7B2-D99B-4554-BBFB-95E75720B8E5}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {48D1B7B2-D99B-4554-BBFB-95E75720B8E5}.Debug|x64.Build.0 = Debug|Any CPU
+ {48D1B7B2-D99B-4554-BBFB-95E75720B8E5}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {48D1B7B2-D99B-4554-BBFB-95E75720B8E5}.Debug|x86.Build.0 = Debug|Any CPU
+ {48D1B7B2-D99B-4554-BBFB-95E75720B8E5}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {48D1B7B2-D99B-4554-BBFB-95E75720B8E5}.Release|Any CPU.Build.0 = Release|Any CPU
+ {48D1B7B2-D99B-4554-BBFB-95E75720B8E5}.Release|x64.ActiveCfg = Release|Any CPU
+ {48D1B7B2-D99B-4554-BBFB-95E75720B8E5}.Release|x64.Build.0 = Release|Any CPU
+ {48D1B7B2-D99B-4554-BBFB-95E75720B8E5}.Release|x86.ActiveCfg = Release|Any CPU
+ {48D1B7B2-D99B-4554-BBFB-95E75720B8E5}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{B335BD79-05C0-4F0E-A2DA-FC72DF07A18C} = {827E0CD3-B72D-47B6-A68D-7590B98EB39B}
+ {B36C9166-6687-1700-0084-D88BD073518A} = {5D20AA90-6969-D8BD-9DCD-8634F4692FDA}
+ {D849CD75-73AE-4F1A-80EA-0FC596C80723} = {B36C9166-6687-1700-0084-D88BD073518A}
+ {6F746C7E-99E8-D040-B792-CDA2514E83CE} = {0AB3BF05-4346-4AA6-1389-037BE0695223}
+ {48D1B7B2-D99B-4554-BBFB-95E75720B8E5} = {6F746C7E-99E8-D040-B792-CDA2514E83CE}
EndGlobalSection
EndGlobal
diff --git a/Samples/MediatorSampleApp/Mediator.csproj b/Samples/MediatorSampleApp/Mediator.csproj
new file mode 100644
index 0000000..6a2e3de
--- /dev/null
+++ b/Samples/MediatorSampleApp/Mediator.csproj
@@ -0,0 +1,14 @@
+
+
+
+ Exe
+ net10.0
+ enable
+ enable
+
+
+
+
+
+
+
diff --git a/Samples/MediatorSampleApp/Program.cs b/Samples/MediatorSampleApp/Program.cs
new file mode 100644
index 0000000..3857774
--- /dev/null
+++ b/Samples/MediatorSampleApp/Program.cs
@@ -0,0 +1,29 @@
+using FluentValidation;
+using KSFramework.Messaging;
+using KSFramework.Messaging.Abstraction;
+using KSFramework.Messaging.Behaviors;
+using KSFramework.Messaging.Configuration;
+using KSFramework.Messaging.Samples;
+using Microsoft.Extensions.DependencyInjection;
+
+var services = new ServiceCollection();
+
+// فقط یکبار mediator رو ثبت کن
+services.AddScoped();
+services.AddScoped(sp => sp.GetRequiredService());
+
+services.AddLogging();
+
+services.AddValidatorsFromAssembly(typeof(Program).Assembly);
+services.AddMessaging(typeof(MultiplyByTwoHandler).Assembly);
+
+// اگر رفتارهای pipeline داری، ثبت کن
+services.AddScoped(typeof(IPipelineBehavior<,>), typeof(RequestProcessorBehavior<,>));
+services.AddMessaging(typeof(ExceptionHandlingBehavior<,>).Assembly, typeof(MultiplyByTwoRequest).Assembly);
+
+var provider = services.BuildServiceProvider();
+
+var mediator = provider.GetRequiredService();
+
+var result = await mediator.Send(new MultiplyByTwoRequest(5));
+Console.WriteLine($"Result: {result}");
\ No newline at end of file
diff --git a/src/KSFramework/Domain/IDomainEvent.cs b/src/KSFramework/Domain/IDomainEvent.cs
index 7562255..09c10b2 100644
--- a/src/KSFramework/Domain/IDomainEvent.cs
+++ b/src/KSFramework/Domain/IDomainEvent.cs
@@ -1,4 +1,4 @@
-using MediatR;
+using KSFramework.Messaging.Abstraction;
namespace KSFramework.Domain;
public interface IDomainEvent : INotification
diff --git a/src/KSFramework/KSFramework.csproj b/src/KSFramework/KSFramework.csproj
index 97b1869..d3bf821 100644
--- a/src/KSFramework/KSFramework.csproj
+++ b/src/KSFramework/KSFramework.csproj
@@ -28,8 +28,10 @@
-
-
+
+
+
+
@@ -38,6 +40,7 @@
+
diff --git a/src/KSFramework/Messaging/Abstraction/IMediator.cs b/src/KSFramework/Messaging/Abstraction/IMediator.cs
new file mode 100644
index 0000000..1df2a1a
--- /dev/null
+++ b/src/KSFramework/Messaging/Abstraction/IMediator.cs
@@ -0,0 +1,44 @@
+namespace KSFramework.Messaging.Abstraction;
+
+///
+/// Represents a mediator that supports sending requests and publishing notifications.
+///
+public interface IMediator : ISender
+{
+ ///
+ /// Publishes a notification to all registered handlers.
+ ///
+ /// The notification type.
+ /// The notification instance.
+ /// Cancellation token.
+ /// A task representing the asynchronous operation.
+ Task Publish(TNotification notification, CancellationToken cancellationToken = default)
+ where TNotification : INotification;
+
+ ///
+ /// Sends a request without knowing the response type at compile time.
+ ///
+ /// The request to send.
+ /// Cancellation token.
+ /// A task that represents the response.
+ Task