-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
47 changed files
with
709 additions
and
329 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
using Sample.Contracts; | ||
using Shiny.Mediator.Middleware; | ||
|
||
namespace Sample; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
namespace Sample.Contracts; | ||
|
||
public record ErrorRequest : IRequest; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
namespace Sample.Contracts; | ||
|
||
public record TickerRequest(int Repeat, int Multiplier, int GapSeconds) : IStreamRequest<string>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using Sample.Contracts; | ||
|
||
namespace Sample.Handlers; | ||
|
||
|
||
[RegisterHandler] | ||
public class ErrorRequestHandler : IRequestHandler<ErrorRequest> | ||
{ | ||
public Task Handle(ErrorRequest request, CancellationToken cancellationToken) | ||
{ | ||
throw new InvalidOperationException("Why you call me?"); | ||
} | ||
} |
5 changes: 3 additions & 2 deletions
5
Sample/MyRequestMiddleware.cs → Sample/Handlers/MyRequestMiddleware.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 3 additions & 1 deletion
4
Sample/SingletonEventHandler.cs → Sample/Handlers/SingletonEventHandler.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
namespace Sample; | ||
using Sample.Contracts; | ||
|
||
namespace Sample.Handlers; | ||
|
||
|
||
[RegisterHandler] | ||
|
4 changes: 3 additions & 1 deletion
4
Sample/SingletonRequestHandler.cs → Sample/Handlers/SingletonRequestHandler.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
namespace Sample; | ||
using Sample.Contracts; | ||
|
||
namespace Sample.Handlers; | ||
|
||
|
||
[RegisterHandler] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using Sample.Contracts; | ||
|
||
namespace Sample.Handlers; | ||
|
||
|
||
[RegisterHandler] | ||
public class TickerStreamRequestHandler : IStreamRequestHandler<TickerRequest, string> | ||
{ | ||
public async IAsyncEnumerable<string> Handle(TickerRequest request, CancellationToken cancellationToken) | ||
{ | ||
for (var i = 0; i < request.Repeat; i++) | ||
{ | ||
await Task.Delay(TimeSpan.FromSeconds(request.GapSeconds)); | ||
var value = i * request.Multiplier; | ||
yield return ($"{i} : {value}"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
using Sample.Contracts; | ||
using SQLite; | ||
|
||
namespace Sample.Services; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,6 @@ | ||
namespace Shiny.Mediator; | ||
|
||
public interface IRequest : IRequest<Unit> | ||
{ | ||
} | ||
|
||
|
||
public interface IRequest<out TResponse> | ||
{ | ||
} | ||
public interface IRequest; | ||
public interface IRequest<out TResult>; | ||
public interface IStreamRequest<out TResult>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using Shiny.Mediator.Maui.Services; | ||
|
||
namespace Shiny.Mediator.Middleware; | ||
|
||
public class CacheHandlers(CacheManager cacheManager) : IRequestHandler<FlushAllCacheRequest>, IRequestHandler<FlushCacheItemRequest> | ||
{ | ||
public Task Handle(FlushAllCacheRequest request, CancellationToken cancellationToken) | ||
{ | ||
cacheManager.FlushAllCache(); | ||
return Task.CompletedTask; | ||
} | ||
|
||
public Task Handle(FlushCacheItemRequest request, CancellationToken cancellationToken) | ||
{ | ||
cacheManager.RemoveCacheItem(request.Request); | ||
return Task.CompletedTask; | ||
} | ||
} |
Oops, something went wrong.