Kyoo/Kyoo.Common/Models/MetadataID.cs
2021-06-07 22:30:40 +02:00

34 lines
834 B
C#

using System;
using System.Linq.Expressions;
namespace Kyoo.Models
{
/// <summary>
/// ID and link of an item on an external provider.
/// </summary>
/// <typeparam name="T"></typeparam>
public class MetadataID<T> : Link<T, Provider>
where T : class, IResource
{
/// <summary>
/// The ID of the resource on the external provider.
/// </summary>
public string DataID { get; set; }
/// <summary>
/// The URL of the resource on the external provider.
/// </summary>
public string Link { get; set; }
/// <summary>
/// The expression to retrieve the unique ID of a MetadataID. This is an aggregate of the two resources IDs.
/// </summary>
public new static Expression<Func<MetadataID<T>, object>> PrimaryKey
{
get
{
return x => new {First = x.FirstID, Second = x.SecondID};
}
}
}
}