using Newtonsoft.Json; using ServerCore; using ServerBase; using META_ID = System.UInt32; namespace ServerCommon; public class CartAttrib : AttribBase { [JsonProperty("cart_items")] public Dictionary> CartItems { get; set; } = new(); public CartAttrib() : base(typeof(CartAttrib).Name) { } } //============================================================================================= // PK(Partition Key) : "cart#user_guid" // SK(Sort Key) : "" // DocType : CartDoc // CartAttrib : {} // ... //============================================================================================= public class CartDoc : DynamoDbDocBase { private static string getPrefixOfPK() { return "cart#"; } public CartDoc() : base(typeof(CartDoc).Name) { appendAttribWrapperAll(); } public CartDoc(string ownerGuid) : base(typeof(CartDoc).Name) { setCombinationKeyForPK(ownerGuid); appendAttribWrapperAll(); fillUpPrimaryKey(onMakePK(), onMakeSK()); setExceptionHandler(new DynamoDbQueryExceptionNotifier.ExceptionHandler(DynamoDbQueryExceptionNotifier.ConditionalCheckFailed, ServerErrorCode.CartDocException)); } private void appendAttribWrapperAll() { appendAttribWrapper(new AttribWrapper()); } protected override string onGetPrefixOfPK() { return getPrefixOfPK(); } }