초기커밋

This commit is contained in:
2025-05-01 07:20:41 +09:00
commit 98bb2e3c5c
2747 changed files with 646947 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
namespace BrokerCore.Entity;
using ServerCommon;
using ServerCore; using ServerBase;
public static class EntityExtensions
{
public static TEntityAttributeBase getEntityAttributeNotNull<TEntityAttributeBase>(this EntityBase entity)
where TEntityAttributeBase : EntityAttributeBase
{
TEntityAttributeBase? attribute = entity.getEntityAttribute<TEntityAttributeBase>();
// todo: 이렇게 널 처리를 하면 일관되게 처리할 수 있지만, null이 발생한 코드 위치가 항상 여기로 찍힌다.
// getEntityAttributeNotNull를 호출한 위치에서 로그를 찍을 수 있는 지 고민해보자.
NullReferenceCheckHelper.throwIfNull(attribute,
() => $"entity attribute {nameof(TEntityAttributeBase)} not found - {entity.toBasicString()}");
return attribute;
}
public static TEntityActionBase getEntityActionNotNull<TEntityActionBase>(this EntityBase entity)
where TEntityActionBase : EntityActionBase
{
TEntityActionBase? action = entity.getEntityAction<TEntityActionBase>();
NullReferenceCheckHelper.throwIfNull(action,
() => $"entity action {nameof(TEntityActionBase)} not found - {entity.toBasicString()}");
return action;
}
}