Files
caliverse_server/ServerCommon/Doc/OwnerContents/SwitchingPropDoc.cs
2025-05-01 07:20:41 +09:00

63 lines
1.6 KiB
C#

using System.Collections.Concurrent;
using Newtonsoft.Json;
using ServerCore;
using ServerBase;
namespace ServerCommon;
public class SwitchingPropAttrib : AttribBase
{
[JsonProperty("switching_props")]
public ConcurrentDictionary<Int32,Int32> m_switching_props { get; set; } = new();
public SwitchingPropAttrib()
: base(typeof(SwitchingPropAttrib).Name)
{ }
}
//=============================================================================================
// PK(Partition Key) : "switching_prop#owner_guid"
// SK(Sort Key) : empty
// DocType : SwitchingPropDoc
//=============================================================================================
public class SwitchingPropDoc : DynamoDbDocBase
{
public SwitchingPropDoc() : base(typeof(SwitchingPropDoc).Name)
{
appendAttribWrapperAll();
}
public SwitchingPropDoc(string guid) : base(typeof(SwitchingPropDoc).Name)
{
setCombinationKeyForPK(guid);
appendAttribWrapperAll();
fillUpPrimaryKey(onMakePK(), onMakeSK());
}
private void appendAttribWrapperAll()
{
appendAttribWrapper(new AttribWrapper<SwitchingPropAttrib>());
}
protected override string onGetPrefixOfPK()
{
return "switching_prop#";
}
protected override string onMakePK()
{
return $"{onGetPrefixOfPK()}{getCombinationKeyForPK()}";
}
protected override ServerErrorCode onCheckAndSetPK(string pk)
{
getPrimaryKey().fillUpPK(pk);
return ServerErrorCode.Success;
}
}