초기커밋
This commit is contained in:
72
ServerCommon/Doc/UserBase/OwnedLandDoc.cs
Normal file
72
ServerCommon/Doc/UserBase/OwnedLandDoc.cs
Normal file
@@ -0,0 +1,72 @@
|
||||
using Newtonsoft.Json;
|
||||
|
||||
|
||||
using ServerCore;
|
||||
using ServerBase;
|
||||
|
||||
|
||||
using META_ID = System.UInt32;
|
||||
|
||||
|
||||
namespace ServerCommon;
|
||||
|
||||
public class OwnedLandAttrib : AttribBase
|
||||
{
|
||||
[JsonProperty("land_meta_id")]
|
||||
public META_ID LandMetaId { get; set; } = 0;
|
||||
|
||||
[JsonProperty("owned_type")]
|
||||
public OwnedType OwnedType { get; set; } = OwnedType.None;
|
||||
|
||||
public OwnedLandAttrib()
|
||||
: base(typeof(OwnedLandAttrib).Name)
|
||||
{ }
|
||||
}
|
||||
|
||||
//=============================================================================================
|
||||
// PK(Partition Key) : "owned_land#user_guid"
|
||||
// SK(Sort Key) : "land_meta_id"
|
||||
// DocType : OwnedLandDoc
|
||||
// OwnedLandAttrib : {}
|
||||
// ...
|
||||
//=============================================================================================
|
||||
public class OwnedLandDoc : DynamoDbDocBase
|
||||
{
|
||||
private static string getPrefixOfPK() { return "owned_land#"; }
|
||||
private static string getPrefixOfSK() { return ""; }
|
||||
|
||||
public OwnedLandDoc()
|
||||
: base(typeof(OwnedLandDoc).Name)
|
||||
{
|
||||
appendAttribWrapperAll();
|
||||
}
|
||||
|
||||
public OwnedLandDoc(string userGuid, META_ID landMetaId)
|
||||
: base(typeof(OwnedLandDoc).Name)
|
||||
{
|
||||
setCombinationKeyForPK(userGuid);
|
||||
setCombinationKeyForSK(landMetaId.ToString());
|
||||
|
||||
appendAttribWrapperAll();
|
||||
|
||||
fillUpPrimaryKey(onMakePK(), onMakeSK());
|
||||
}
|
||||
|
||||
private void appendAttribWrapperAll()
|
||||
{
|
||||
appendAttribWrapper(new AttribWrapper<OwnedLandAttrib>());
|
||||
}
|
||||
|
||||
protected override string onGetPrefixOfPK()
|
||||
{
|
||||
return getPrefixOfPK();
|
||||
}
|
||||
|
||||
protected override ServerErrorCode onCheckAndSetSK(string sortKey)
|
||||
{
|
||||
getPrimaryKey().fillUpSK(sortKey);
|
||||
setCombinationKeyForSK(sortKey);
|
||||
|
||||
return ServerErrorCode.Success;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user