초기커밋
This commit is contained in:
115
ServerCommon/Doc/OwnerContents/ToolActionDoc.cs
Normal file
115
ServerCommon/Doc/OwnerContents/ToolActionDoc.cs
Normal file
@@ -0,0 +1,115 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
||||
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 ITEM_GUID = System.String;
|
||||
|
||||
|
||||
|
||||
namespace ServerCommon;
|
||||
|
||||
public class ToolActionAttrib : AttribBase
|
||||
{
|
||||
[JsonProperty("item_guid")]
|
||||
public ITEM_GUID ItemGuid { get; set; } = string.Empty;
|
||||
|
||||
[JsonProperty("item_meta_id")]
|
||||
public META_ID ItemMetaId { get; set; } = 0;
|
||||
|
||||
[JsonProperty("step")]
|
||||
public Int32 Step { get; set; } = 0;
|
||||
|
||||
[JsonProperty("random_state")]
|
||||
public Int32 RandomState { get; set; } = 0;
|
||||
|
||||
[JsonProperty("action_start_date_time")]
|
||||
public Int64 ActionStartDateTime { get; set; } = 0;
|
||||
|
||||
[JsonProperty("owner_guid")]
|
||||
public OWNER_GUID OwnerGuid { get; set; } = string.Empty;
|
||||
|
||||
[JsonProperty("owner_entity_type")]
|
||||
public OwnerEntityType OwnerEntityType { get; set; } = OwnerEntityType.None;
|
||||
|
||||
public ToolActionAttrib()
|
||||
: base(typeof(ToolActionAttrib).Name)
|
||||
{ }
|
||||
}
|
||||
|
||||
//=============================================================================================
|
||||
// Primary Key
|
||||
// PK(Partition Key) : "tool_action#owner_guid" [owner_guid : user_guid]
|
||||
// SK(Sort Key) : "tool_item_meta_id"
|
||||
// DocType : ToolActionDoc
|
||||
// ToolActionAttrib : {}
|
||||
// ...
|
||||
//=============================================================================================
|
||||
public class ToolActionDoc : DynamoDbDocBase
|
||||
{
|
||||
private static string getPrefixOfPK() { return "tool_action#"; }
|
||||
private static string getPrefixOfSK() { return $""; }
|
||||
|
||||
public ToolActionDoc()
|
||||
: base(typeof(ToolActionDoc).Name)
|
||||
{
|
||||
appendAttribWrapperAll();
|
||||
}
|
||||
|
||||
public ToolActionDoc(OwnerEntityType owneEntityType, string ownerGuid, UInt32 toolItemMetaId)
|
||||
: base(typeof(ToolActionDoc).Name)
|
||||
{
|
||||
setCombinationKeyForPK(ownerGuid);
|
||||
setCombinationKeyForSK(toolItemMetaId.ToString());
|
||||
|
||||
appendAttribWrapperAll();
|
||||
|
||||
fillUpPrimaryKey(onMakePK(), onMakeSK());
|
||||
|
||||
var tool_action_attrib = getAttrib<ToolActionAttrib>();
|
||||
NullReferenceCheckHelper.throwIfNull(tool_action_attrib, () => $"tool_action_attrib is null !!!");
|
||||
|
||||
tool_action_attrib.OwnerEntityType = owneEntityType;
|
||||
tool_action_attrib.OwnerGuid = ownerGuid;
|
||||
tool_action_attrib.ItemMetaId = toolItemMetaId;
|
||||
}
|
||||
|
||||
private void appendAttribWrapperAll()
|
||||
{
|
||||
appendAttribWrapper(new AttribWrapper<ToolActionAttrib>());
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user