2018-11-03 21:21:36 +00:00
|
|
|
|
using System;
|
2018-11-04 15:16:52 +00:00
|
|
|
|
using System.Linq;
|
2018-11-03 21:21:36 +00:00
|
|
|
|
|
|
|
|
|
namespace Roadie.Library.Data
|
|
|
|
|
{
|
|
|
|
|
public partial class Label
|
|
|
|
|
{
|
2018-11-11 20:10:10 +00:00
|
|
|
|
public static string CacheRegionUrn(Guid Id)
|
2018-11-10 18:03:54 +00:00
|
|
|
|
{
|
|
|
|
|
return string.Format("urn:label:{0}", Id);
|
|
|
|
|
}
|
|
|
|
|
|
2018-11-11 20:10:10 +00:00
|
|
|
|
public static string CacheUrn(Guid Id)
|
|
|
|
|
{
|
|
|
|
|
return $"urn:label_by_id:{ Id }";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string CacheKey
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return Label.CacheUrn(this.RoadieId);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2018-11-03 21:21:36 +00:00
|
|
|
|
public string CacheRegion
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
2018-11-11 20:10:10 +00:00
|
|
|
|
return Label.CacheRegionUrn(this.RoadieId);
|
2018-11-03 21:21:36 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2018-11-04 20:33:37 +00:00
|
|
|
|
|
2018-11-03 21:21:36 +00:00
|
|
|
|
public string Etag
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
using (var md5 = System.Security.Cryptography.MD5.Create())
|
|
|
|
|
{
|
2018-11-04 15:16:52 +00:00
|
|
|
|
return String.Concat(md5.ComputeHash(System.Text.Encoding.Default.GetBytes(string.Format("{0}{1}", this.RoadieId, this.LastUpdated))).Select(x => x.ToString("D2")));
|
2018-11-03 21:21:36 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-11-04 20:33:37 +00:00
|
|
|
|
|
2018-11-03 21:21:36 +00:00
|
|
|
|
public bool IsValid
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return !string.IsNullOrEmpty(this.Name);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-11-04 20:33:37 +00:00
|
|
|
|
}
|