2018-11-04 20:33:37 +00:00
|
|
|
|
using Roadie.Library.Configuration;
|
2018-11-03 21:21:36 +00:00
|
|
|
|
using Roadie.Library.Utility;
|
|
|
|
|
using System;
|
2019-11-04 03:19:04 +00:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
2018-11-03 21:21:36 +00:00
|
|
|
|
|
|
|
|
|
namespace Roadie.Library.Data
|
|
|
|
|
{
|
|
|
|
|
public partial class Artist
|
|
|
|
|
{
|
2019-07-03 16:21:29 +00:00
|
|
|
|
public string CacheKey => CacheUrn(RoadieId);
|
2018-11-22 23:12:57 +00:00
|
|
|
|
|
2019-07-03 16:21:29 +00:00
|
|
|
|
public string CacheRegion => CacheRegionUrn(RoadieId);
|
2018-11-03 21:21:36 +00:00
|
|
|
|
|
|
|
|
|
public string Etag
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
2019-07-31 22:42:49 +00:00
|
|
|
|
return HashHelper.CreateMD5($"{ RoadieId }{ LastUpdated }");
|
2018-11-03 21:21:36 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-11-04 03:19:04 +00:00
|
|
|
|
[NotMapped]
|
2019-11-18 03:30:54 +00:00
|
|
|
|
public IEnumerable<Imaging.IImage> Images { get; set; }
|
2019-11-04 03:19:04 +00:00
|
|
|
|
|
2019-07-03 16:21:29 +00:00
|
|
|
|
public bool IsNew => Id < 1;
|
|
|
|
|
|
|
|
|
|
public bool IsValid => !string.IsNullOrEmpty(Name);
|
|
|
|
|
|
2019-10-23 13:45:36 +00:00
|
|
|
|
public string GroupBy => SortNameValue.Substring(0, 1).ToUpper();
|
|
|
|
|
|
2019-07-03 16:21:29 +00:00
|
|
|
|
public static string CacheRegionUrn(Guid Id)
|
2018-11-03 21:21:36 +00:00
|
|
|
|
{
|
2019-07-03 16:21:29 +00:00
|
|
|
|
return $"urn:artist:{Id}";
|
2018-11-03 21:21:36 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-07-03 16:21:29 +00:00
|
|
|
|
public static string CacheUrn(Guid Id)
|
2018-11-03 21:21:36 +00:00
|
|
|
|
{
|
2019-07-03 16:21:29 +00:00
|
|
|
|
return $"urn:artist_by_id:{Id}";
|
2018-11-03 21:21:36 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-07-03 16:21:29 +00:00
|
|
|
|
public static string CacheUrnByName(string name)
|
2018-11-03 21:21:36 +00:00
|
|
|
|
{
|
2019-07-03 16:21:29 +00:00
|
|
|
|
return $"urn:artist_by_name:{name}";
|
2018-11-03 21:21:36 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-11-17 20:02:19 +00:00
|
|
|
|
public string ArtistFileFolder(IRoadieSettings configuration, bool createIfNotFound = false)
|
2018-11-03 21:21:36 +00:00
|
|
|
|
{
|
2019-11-17 20:02:19 +00:00
|
|
|
|
return FolderPathHelper.ArtistPath(configuration, Id, SortNameValue, createIfNotFound);
|
2018-11-03 21:21:36 +00:00
|
|
|
|
}
|
2018-11-04 20:33:37 +00:00
|
|
|
|
|
|
|
|
|
public override string ToString()
|
|
|
|
|
{
|
2019-11-28 17:38:26 +00:00
|
|
|
|
return $"Id [{ Id }], Status [{ Status }], Name [{ Name }], SortName [{ SortName }], RoadieId [{ RoadieId}]";
|
2018-11-04 20:33:37 +00:00
|
|
|
|
}
|
2018-11-03 21:21:36 +00:00
|
|
|
|
}
|
2018-11-04 20:33:37 +00:00
|
|
|
|
}
|