초기커밋
This commit is contained in:
107
ServerCommon/Entity/DbQuery/DBQWithItemRequestQueryContext.cs
Normal file
107
ServerCommon/Entity/DbQuery/DBQWithItemRequestQueryContext.cs
Normal file
@@ -0,0 +1,107 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
||||
using ServerCore; using ServerBase;
|
||||
using ServerCommon.BusinessLogDomain;
|
||||
|
||||
|
||||
using SESSION_ID = System.Int32;
|
||||
using WORLD_ID = System.UInt32;
|
||||
using META_ID = System.UInt32;
|
||||
using ENTITY_GUID = System.String;
|
||||
using ACCOUNT_ID = System.String;
|
||||
using OWNER_GUID = System.String;
|
||||
using USER_GUID = System.String;
|
||||
using CHARACTER_GUID = System.String;
|
||||
using ITEM_GUID = System.String;
|
||||
|
||||
|
||||
|
||||
namespace ServerCommon
|
||||
{
|
||||
public class DBQWithItemRequestQueryContext : QueryExecutorBase
|
||||
{
|
||||
private readonly List<DynamoDbItemRequestQueryContext> m_to_query_item_request_query_contexts = new();
|
||||
|
||||
public DBQWithItemRequestQueryContext(DynamoDbItemRequestQueryContext queryContext)
|
||||
: base(typeof(DBQWithItemRequestQueryContext).Name)
|
||||
{
|
||||
m_to_query_item_request_query_contexts.Add(queryContext);
|
||||
}
|
||||
|
||||
public DBQWithItemRequestQueryContext(List<DynamoDbItemRequestQueryContext> queryContexts)
|
||||
: base(typeof(DBQWithItemRequestQueryContext).Name)
|
||||
{
|
||||
m_to_query_item_request_query_contexts = queryContexts;
|
||||
}
|
||||
|
||||
//=====================================================================================
|
||||
// DB 쿼리 직전에 준비해야 할 로직들을 작성한다.
|
||||
//=====================================================================================
|
||||
public override async Task<Result> onPrepareQuery()
|
||||
{
|
||||
await Task.CompletedTask;
|
||||
|
||||
var result = new Result();
|
||||
var err_msg = string.Empty;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
//=====================================================================================
|
||||
// onPrepareQuery()를 성공할 경우 호출된다.
|
||||
//=====================================================================================
|
||||
public override async Task<Result> onQuery()
|
||||
{
|
||||
var result = new Result();
|
||||
var err_msg = string.Empty;
|
||||
|
||||
var owner = getOwner();
|
||||
NullReferenceCheckHelper.throwIfNull(owner, () => $"owner is null !!!");
|
||||
|
||||
var query_batch = getQueryBatch();
|
||||
NullReferenceCheckHelper.throwIfNull(query_batch, () => $"query_batch is null !!! - {owner.toBasicString()}");
|
||||
|
||||
var query_runner = query_batch.getQueryRunner();
|
||||
NullReferenceCheckHelper.throwIfNull(query_runner, () => $"query_runner is null !!! - {owner.toBasicString()}");
|
||||
|
||||
foreach (var query_context in m_to_query_item_request_query_contexts)
|
||||
{
|
||||
result = await query_runner.tryRegisterQueryContext(query_context);
|
||||
if (result.isFail())
|
||||
{
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
var msg = $"{this.getTypeName()} : tryQueryCount:{m_to_query_item_request_query_contexts.Count}, isUseTransact:{query_batch.isUseTransact()} - TransId:{query_batch.getTransId()}";
|
||||
Log.getLogger().info(msg);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<DynamoDbItemRequestQueryContext> getToItemRequestQueryContexts() => m_to_query_item_request_query_contexts;
|
||||
|
||||
//=====================================================================================
|
||||
// DB 쿼리를 성공하고, doFnCommit()가 QueryResultType.NotCalledQueryFunc를 반환할 경우 호출된다.
|
||||
//=====================================================================================
|
||||
public override async Task onQueryResponseCommit()
|
||||
{
|
||||
await Task.CompletedTask;
|
||||
return;
|
||||
}
|
||||
|
||||
//=====================================================================================
|
||||
// DB 쿼리를 실패하고, doFnRollback()가 QueryResultType.NotCalledQueryFunc를 반환할 경우 호출된다.
|
||||
//=====================================================================================
|
||||
public override async Task onQueryResponseRollback(Result errorResult)
|
||||
{
|
||||
await Task.CompletedTask;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user