mirror of
https://github.com/DrMboga/WotBlitzStatisticsBlazor.git
synced 2026-11-02 23:20:51 +01:00
Some Operation context refactor
This commit is contained in:
1 parent
ed52a65788
commit
ec8f434f42
16 files changed
+163
-119
No files matched your search
+18
@@ -0,0 +1,18 @@
|
||||
using WotBlitzStatisticsPro.Common.Model;
|
||||
|
||||
namespace WotBlitzStatisticsPro.Logic.AccountInformationPipeline.OperationContext
|
||||
{
|
||||
public class AccountRequest
|
||||
{
|
||||
public AccountRequest(long accountId, RealmType realmType, RequestLanguage requestLanguage)
|
||||
{
|
||||
AccountId = accountId;
|
||||
RealmType = realmType;
|
||||
RequestLanguage = requestLanguage;
|
||||
}
|
||||
|
||||
public long AccountId { get; }
|
||||
public RealmType RealmType { get; }
|
||||
public RequestLanguage RequestLanguage { get; }
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
namespace WotBlitzStatisticsPro.Logic.AccountInformationPipeline.OperationContext
|
||||
{
|
||||
public interface IOperationContext
|
||||
{
|
||||
AccountRequest Request { get; }
|
||||
|
||||
void AddOrReplace<TContextData>(TContextData data);
|
||||
|
||||
TContextData Get<TContextData>();
|
||||
}
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
namespace WotBlitzStatisticsPro.Logic.AccountInformationPipeline.OperationContext
|
||||
{
|
||||
public class OperationContext : IOperationContext
|
||||
{
|
||||
private object _contextData;
|
||||
|
||||
|
||||
public OperationContext(AccountRequest request)
|
||||
{
|
||||
Request = request;
|
||||
}
|
||||
|
||||
public AccountRequest Request { get; }
|
||||
|
||||
public void AddOrReplace<TContextData>(TContextData data)
|
||||
{
|
||||
_contextData = data;
|
||||
}
|
||||
|
||||
public TContextData Get<TContextData>()
|
||||
{
|
||||
_contextData ??= default(TContextData);
|
||||
|
||||
return (TContextData)_contextData;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user