55 lines
2.0 KiB
C#
55 lines
2.0 KiB
C#
//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 BuildingAttr
|
|
// {
|
|
// public string Owner = string.Empty;
|
|
// public string Name = string.Empty;
|
|
// public string Description = string.Empty;
|
|
// public Dictionary<int, int> FloorInfo = new Dictionary<int, int>();
|
|
// public Dictionary<string, AnchorProp> PropInfo = new();
|
|
// }
|
|
|
|
// public class BuildingEntity
|
|
// {
|
|
// public int PK_Id { get; private set; } = 0;
|
|
// public int SK_Id { get; private set; } = 0;
|
|
// public BuildingAttr Attr { get; private set; } = new();
|
|
|
|
// public BuildingEntity(Document document)
|
|
// {
|
|
// ReadFrom(document);
|
|
// }
|
|
|
|
// void ReadFrom(Document document)
|
|
// {
|
|
// if (!int.TryParse(document["PK"].AsString().Replace(MainDB.GetPKPrefix(EEntityType.Building), ""), out var pk))
|
|
// throw new Exception("PK int.TryParse error");
|
|
|
|
// if (!int.TryParse(document["SK"].AsString().Replace(MainDB.GetSKPrefix(EEntityType.Building), ""), out var sk))
|
|
// throw new Exception("SK int.TryParse error");
|
|
|
|
// BuildingAttr? attr = JsonConvert.DeserializeObject<BuildingAttr>(document["Attr"].AsString());
|
|
// if (attr == null)
|
|
// throw new Exception("Attr DeserializeObject error");
|
|
|
|
// Attr = attr;
|
|
// }
|
|
|
|
// public Document DocumentForUpdate()
|
|
// {
|
|
// var document = new Document();
|
|
// document["PK"] = MainDB.MakePK(EEntityType.Building, PK_Id.ToString());
|
|
// document["SK"] = MainDB.MakeSK(EEntityType.Building, SK_Id.ToString());
|
|
// document["Attr"] = JsonConvert.SerializeObject(Attr);
|
|
// return document;
|
|
// }
|
|
// }
|
|
//} |