示例#1
0
 public static ResourcePackEntity Pack(this IPackableEntity entity)
 {
     return(new ResourcePackEntity(entity.PackPartitionKey(), entity.PackRowKey())
     {
         Type = entity.Type,
         JsonPayload = JsonConvert.SerializeObject(entity),
     });
 }
示例#2
0
 public static string PackVersion(this IPackableEntity entity)
 {
     return(Utils.InversedTimeKey(entity.ResourceVersionTime));
 }
示例#3
0
 public static string PackRowKey(this IPackableEntity entity)
 {
     return(entity.PackVersion());
 }
示例#4
0
 public static string PackPartitionKey(this IPackableEntity entity)
 {
     return(PackableEntityUtil.PackPartitionKey(entity.Type, entity.ResourceIdentifier));
 }
示例#5
0
 public static string PrettyString(this IPackableEntity entity)
 {
     return($"{entity.Type}/{entity.NameRegion}/{entity.Name}/{entity.PackPartitionKey()}/{entity.ValidTime()}");
 }
示例#6
0
 /*
  * public static ResourcePackEntity Pack(this IPackableEntity entity)
  * {
  *  return new ResourcePackEntity(entity.PackPartitionKey(), entity.PackRowKey())
  *  {
  *      Type = entity.Type,
  *      JsonPayload = JsonConvert.SerializeObject(entity),
  *  };
  * }
  */
 public static DateTime ValidTime(this IPackableEntity entity)
 {
     return(entity.IsDeleted ? entity.ResourceVersionTime : entity.CheckTime);
 }