Beispiel #1
0
 public static ResourcePackEntity Pack(this IPackableEntity entity)
 {
     return(new ResourcePackEntity(entity.PackPartitionKey(), entity.PackRowKey())
     {
         Type = entity.Type,
         JsonPayload = JsonConvert.SerializeObject(entity),
     });
 }
 public static string PackVersion(this IPackableEntity entity)
 {
     return(Utils.InversedTimeKey(entity.ResourceVersionTime));
 }
 public static string PackRowKey(this IPackableEntity entity)
 {
     return(entity.PackVersion());
 }
 public static string PackPartitionKey(this IPackableEntity entity)
 {
     return(PackableEntityUtil.PackPartitionKey(entity.Type, entity.ResourceIdentifier));
 }
 public static string PrettyString(this IPackableEntity entity)
 {
     return($"{entity.Type}/{entity.NameRegion}/{entity.Name}/{entity.PackPartitionKey()}/{entity.ValidTime()}");
 }
 /*
  * 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);
 }