using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Google.Protobuf.WellKnownTypes; 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 UGC_NPC_META_GUID = System.String; using ITEM_GUID = System.String; namespace ServerCommon; public class UgcNpcLikeSelectedFlagAttrib : AttribBase { [JsonProperty("ugc_npc_meta_guid")] public UGC_NPC_META_GUID UgcNpcMetaGuid { get; set; } = string.Empty; [JsonProperty("is_selected_flag")] public bool IsSelectedFlag { get; set; } = false; [JsonProperty("owner_guid")] public OWNER_GUID OwnerGuid { get; set; } = string.Empty; [JsonProperty("owner_entity_type")] public OwnerEntityType OwnerEntityType { get; set; } = OwnerEntityType.None; [JsonProperty("last_check_date")] public DateTime LastCheckDate { get; set; } = DateTimeHelper.MinTime; public UgcNpcLikeSelectedFlagAttrib() : base(typeof(UgcNpcLikeSelectedFlagAttrib).Name, false) { } } //============================================================================================= // Primary Key // PK(Partition Key) : "ugc_npc_like_selected_flag#owner_guid" [owner_guid : user_guid] // SK(Sort Key) : "ugc_npc_meta_guid" // DocType : UgcNpcLikeSelectedFlagDoc // ItemAttrib : {} // ... //============================================================================================= public class UgcNpcLikeSelectedFlagDoc : DynamoDbDocBase { private static string getPrefixOfPK() { return "ugc_npc_like_selected_flag#"; } private static string getPrefixOfSK() { return ""; } public UgcNpcLikeSelectedFlagDoc() : base(typeof(UgcNpcLikeSelectedFlagDoc).Name) { appendAttribWrapperAll(); } public UgcNpcLikeSelectedFlagDoc(OwnerEntityType ownerEntityType, string ownerGuid, UGC_NPC_META_GUID ugcNpcMetaGuid) : base(typeof(UgcNpcLikeSelectedFlagDoc).Name) { setCombinationKeyForPK(ownerGuid); setCombinationKeyForSK(ugcNpcMetaGuid); appendAttribWrapperAll(); fillUpPrimaryKey(onMakePK(), onMakeSK()); var doc_ugc_npc_like_selected_flag_attrib = getAttrib(); NullReferenceCheckHelper.throwIfNull(doc_ugc_npc_like_selected_flag_attrib, () => $"doc_ugc_npc_like_selected_flag_attrib is null !!! - ownerGuid:{ownerGuid}, ownerEntityType:{ownerEntityType}"); doc_ugc_npc_like_selected_flag_attrib.OwnerGuid = ownerGuid; doc_ugc_npc_like_selected_flag_attrib.OwnerEntityType = ownerEntityType; doc_ugc_npc_like_selected_flag_attrib.UgcNpcMetaGuid = ugcNpcMetaGuid; } public UgcNpcLikeSelectedFlagDoc(OwnerEntityType ownerEntityType, string ownerGuid, UGC_NPC_META_GUID ugcNpcMetaGuid, bool isSelectedFlag) : base(typeof(UgcNpcLikeSelectedFlagDoc).Name) { setCombinationKeyForPK(ownerGuid); setCombinationKeyForSK(ugcNpcMetaGuid); appendAttribWrapperAll(); fillUpPrimaryKey(onMakePK(), onMakeSK()); var doc_ugc_npc_like_selected_flag_attrib = getAttrib(); NullReferenceCheckHelper.throwIfNull(doc_ugc_npc_like_selected_flag_attrib, () => $"doc_ugc_npc_like_selected_flag_attrib is null !!! - ownerGuid:{ownerGuid}, ownerEntityType:{ownerEntityType}"); doc_ugc_npc_like_selected_flag_attrib.OwnerGuid = ownerGuid; doc_ugc_npc_like_selected_flag_attrib.OwnerEntityType = ownerEntityType; doc_ugc_npc_like_selected_flag_attrib.UgcNpcMetaGuid = ugcNpcMetaGuid; doc_ugc_npc_like_selected_flag_attrib.IsSelectedFlag = isSelectedFlag; } private void appendAttribWrapperAll() { appendAttribWrapper(new AttribWrapper()); } protected override string onGetPrefixOfPK() { return getPrefixOfPK(); } protected override string onGetPrefixOfSK() { return getPrefixOfSK(); } protected override ServerErrorCode onCheckAndSetSK(string sortKey) { getPrimaryKey().fillUpSK(sortKey); setCombinationKeyForSK(sortKey); return ServerErrorCode.Success; } }