/// <summary> /// Initializes a new instance of the <see cref="CategoryCI"/> class. /// </summary> /// <param name="exportable">A <see cref="ExportableCategoryCI" /> representing the cache item</param> public CategoryCI(ExportableCategoryCI exportable) : base(exportable) { SportId = URN.Parse(exportable.SportId); TournamentIds = exportable.TournamentIds != null ? new ReadOnlyCollection <URN>(exportable.TournamentIds.Select(URN.Parse).ToList()) : null; CountryCode = exportable.CountryCode; }
/// <summary> /// Asynchronous export item's properties /// </summary> /// <returns>An <see cref="ExportableCI"/> instance containing all relevant properties</returns> public Task <ExportableCI> ExportAsync() { var exportable = new ExportableCategoryCI { Id = Id.ToString(), Name = new ReadOnlyDictionary <CultureInfo, string>(Name), SportId = SportId.ToString(), TournamentIds = TournamentIds != null ? new ReadOnlyCollection <string>(TournamentIds.Select(id => id.ToString()).ToList()) : null, CountryCode = CountryCode }; return(Task.FromResult <ExportableCI>(exportable)); }