mirror of
https://github.com/zoriya/Kyoo.git
synced 2026-06-07 06:45:23 -04:00
Finishing to fix repositories
This commit is contained in:
@@ -3,21 +3,63 @@ using System.Linq.Expressions;
|
||||
|
||||
namespace Kyoo.Models
|
||||
{
|
||||
public class Link<T1, T2>
|
||||
where T1 : class, IResource
|
||||
where T2 : class, IResource
|
||||
public class Link
|
||||
{
|
||||
public static Expression<Func<Link<T1, T2>, object>> PrimaryKey
|
||||
public int FirstID { get; set; }
|
||||
public int SecondID { get; set; }
|
||||
|
||||
public Link() {}
|
||||
|
||||
public Link(IResource first, IResource second)
|
||||
{
|
||||
FirstID = first.ID;
|
||||
SecondID = second.ID;
|
||||
}
|
||||
|
||||
public static Link Create(IResource first, IResource second)
|
||||
{
|
||||
return new(first, second);
|
||||
}
|
||||
|
||||
public static Link<T, T2> Create<T, T2>(T first, T2 second)
|
||||
where T : class, IResource
|
||||
where T2 : class, IResource
|
||||
{
|
||||
return new(first, second);
|
||||
}
|
||||
|
||||
public static Expression<Func<Link, object>> PrimaryKey
|
||||
{
|
||||
get
|
||||
{
|
||||
return x => new {LibraryID = x.FirstID, ProviderID = x.SecondID};
|
||||
}
|
||||
}
|
||||
|
||||
public int FirstID { get; set; }
|
||||
}
|
||||
|
||||
public class Link<T1, T2> : Link
|
||||
where T1 : class, IResource
|
||||
where T2 : class, IResource
|
||||
{
|
||||
public virtual T1 First { get; set; }
|
||||
public int SecondID { get; set; }
|
||||
public virtual T2 Second { get; set; }
|
||||
|
||||
|
||||
public Link() {}
|
||||
|
||||
public Link(T1 first, T2 second)
|
||||
: base(first, second)
|
||||
{
|
||||
First = first;
|
||||
Second = second;
|
||||
}
|
||||
|
||||
public new static Expression<Func<Link<T1, T2>, object>> PrimaryKey
|
||||
{
|
||||
get
|
||||
{
|
||||
return x => new {LibraryID = x.FirstID, ProviderID = x.SecondID};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -27,7 +27,7 @@ namespace Kyoo.Models
|
||||
[EditableRelation] [LoadableRelation] public virtual ICollection<MetadataID> ExternalIDs { get; set; }
|
||||
|
||||
|
||||
public int? StudioID { get; set; }
|
||||
[SerializeIgnore] public int? StudioID { get; set; }
|
||||
[LoadableRelation] [EditableRelation] public virtual Studio Studio { get; set; }
|
||||
[LoadableRelation] [EditableRelation] public virtual ICollection<Genre> Genres { get; set; }
|
||||
[LoadableRelation] [EditableRelation] public virtual ICollection<PeopleRole> People { get; set; }
|
||||
|
||||
Reference in New Issue
Block a user