//using System; //using System.Collections.Generic; //using System.Linq; //using System.Text; //using System.Threading.Tasks; //using Amazon.DynamoDBv2.DocumentModel; //using Newtonsoft.Json; //namespace ServerCommon.DB //{ // public class LandAttr // { // public string Owner = string.Empty; // public string Name = string.Empty; // public string Description = string.Empty; // public int BuildingId; // public Dictionary PropInfo = new(); // public DateTime NFTUpdateTime; // } // public class LandEntity // { // public int PK_Id { get; private set; } = 0; // public int SK_Id { get; private set; } = 0; // public LandAttr Attr { get; private set; } = new(); // public LandEntity(Document document) // { // ReadFrom(document); // } // void ReadFrom(Document document) // { // if (!int.TryParse(document["PK"].AsString().Replace(MainDB.GetPKPrefix(EEntityType.Land), ""), out var pk)) // throw new Exception("PK int.TryParse error"); // if (!int.TryParse(document["SK"].AsString().Replace(MainDB.GetSKPrefix(EEntityType.Land), ""), out var sk)) // throw new Exception("SK int.TryParse error"); // LandAttr? attr = JsonConvert.DeserializeObject(document["Attr"].AsString()); // if (attr == null) // throw new Exception("Attr DeserializeObject error"); // PK_Id = pk; // SK_Id = sk; // Attr = attr; // } // public Document DocumentForUpdate() // { // var document = new Document(); // document["PK"] = MainDB.MakePK(EEntityType.Land, PK_Id.ToString()); // document["SK"] = MainDB.MakeSK(EEntityType.Land, SK_Id.ToString()); // document["Attr"] = JsonConvert.SerializeObject(Attr); // return document; // } // } //}