using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Newtonsoft.Json; using ServerCore; using ServerBase; using SESSION_ID = System.Int32; 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 SocialActionAttrib : AttribBase { [JsonProperty("owner_guid")] public OWNER_GUID OwnerGuid { get; set; } = string.Empty; [JsonProperty("owner_entity_type")] public OwnerEntityType OwnerEntityType { get; set; } = OwnerEntityType.None; [JsonProperty("social_action_meta_id")] public META_ID SocialActionMetaId { get; set; } = 0; [JsonProperty("equiped_pos")] public UInt16 EquipedPos { get; set; } = 0; public SocialActionAttrib() : base(typeof(SocialActionAttrib).Name) { } } //============================================================================================= // PK(Partition Key) : "social_action#owner_guid" // SK(Sort Key) : "social_action_meta_id" // DocType : SocialActionDoc // SocialActionAttrib : {} // ... //============================================================================================= public class SocialActionDoc : DynamoDbDocBase { private static string getPrefixOfPK() { return "social_action#"; } private static string getPrefixOfSK() { return ""; } public SocialActionDoc() : base(typeof(SocialActionDoc).Name) { appendAttribWrapperAll(); } public SocialActionDoc(OwnerEntityType ownerEntityType, string ownerGuid, META_ID socialActionMetaId) : base(typeof(SocialActionDoc).Name) { setCombinationKeyForPK(ownerGuid); setCombinationKeyForSK(socialActionMetaId.ToString()); appendAttribWrapperAll(); fillUpPrimaryKey(onMakePK(), onMakeSK()); var social_action_attrib = getAttrib(); NullReferenceCheckHelper.throwIfNull(social_action_attrib, () => $"social_action_attrib is null !!!"); social_action_attrib.OwnerGuid = ownerGuid; social_action_attrib.OwnerEntityType = ownerEntityType; } private void appendAttribWrapperAll() { appendAttribWrapper(new AttribWrapper()); } protected override string onGetPrefixOfPK() { return getPrefixOfPK(); } protected override ServerErrorCode onCheckAndSetSK(string sortKey) { getPrimaryKey().fillUpSK(sortKey); setCombinationKeyForSK(sortKey); return ServerErrorCode.Success; } }