using System.Collections.Concurrent; using Newtonsoft.Json; using ServerCore; using ServerBase; namespace ServerCommon; public class SwitchingPropAttrib : AttribBase { [JsonProperty("switching_props")] public ConcurrentDictionary 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()); } 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; } }