61 lines
1.7 KiB
C#
61 lines
1.7 KiB
C#
|
|
using ServerCore;
|
|
using ServerBase;
|
|
using ServerCommon;
|
|
|
|
|
|
namespace BrokerCore.Entity;
|
|
|
|
using Actions;
|
|
|
|
|
|
public class BrokerMailEntity : EntityBase, IWithLogActor
|
|
{
|
|
private readonly EntityBase m_parent;
|
|
private readonly IServerLogic m_server_logic;
|
|
|
|
// !! 주의 현상태에서는 EntityBase는 반드시 UserBase여야 한다.
|
|
// !! MailAttribute가 AccountAttribute를 참조하고, AccountAttribute는 UserBase를 참조하기 때문
|
|
public BrokerMailEntity(EntityBase parent, IServerLogic serverLogic)
|
|
: base(EntityType.Mail, parent)
|
|
{
|
|
this.m_parent = parent;
|
|
this.m_server_logic = serverLogic;
|
|
}
|
|
|
|
//====================================================================================================
|
|
// mail에 동록된 모든 Attribute와 Action을 초기화
|
|
//====================================================================================================
|
|
public override async Task<Result> onInit()
|
|
{
|
|
addEntityAttribute(new MailAttribute(this, m_parent));
|
|
addEntityAction(new BrokerMailSendAction(this, m_server_logic.getDynamoDbClient()));
|
|
addEntityAction(new BrokerMailRecvAction(this, m_server_logic.getDynamoDbClient()));
|
|
|
|
var mail_attribute = this.getEntityAttributeNotNull<MailAttribute>();
|
|
var result = await mail_attribute.onInit();
|
|
if (result.isFail())
|
|
{
|
|
return result;
|
|
}
|
|
|
|
var mail_send_action = this.getEntityActionNotNull<BrokerMailSendAction>();
|
|
result = await mail_send_action.onInit();
|
|
if (result.isFail())
|
|
{
|
|
return result;
|
|
}
|
|
|
|
return await base.onInit();
|
|
}
|
|
|
|
public ILogActor toLogActor()
|
|
{
|
|
var log_actor = m_parent as IWithLogActor;
|
|
NullReferenceCheckHelper.throwIfNull(log_actor,
|
|
() => $"m_parent is not IWithLogActor");
|
|
return log_actor.toLogActor();
|
|
}
|
|
}
|
|
|