mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-06-23 15:30:34 -04:00
Fixing the null pattern match
This commit is contained in:
parent
466873da9f
commit
49f0ab8bfa
@ -63,11 +63,11 @@ namespace Kyoo.Controllers
|
|||||||
|
|
||||||
Task Load<T, T2>([NotNull] T obj, [CanBeNull] Expression<Func<T, T2>> member)
|
Task Load<T, T2>([NotNull] T obj, [CanBeNull] Expression<Func<T, T2>> member)
|
||||||
where T : class, IResource
|
where T : class, IResource
|
||||||
where T2 : class, IResource;
|
where T2 : class, IResource, new();
|
||||||
|
|
||||||
Task Load<T, T2>([NotNull] T obj, [CanBeNull] Expression<Func<T, ICollection<T2>>> member)
|
Task Load<T, T2>([NotNull] T obj, [CanBeNull] Expression<Func<T, ICollection<T2>>> member)
|
||||||
where T : class, IResource
|
where T : class, IResource
|
||||||
where T2 : class;
|
where T2 : class, new();
|
||||||
|
|
||||||
// Library Items relations
|
// Library Items relations
|
||||||
Task<ICollection<LibraryItem>> GetItemsFromLibrary(int id,
|
Task<ICollection<LibraryItem>> GetItemsFromLibrary(int id,
|
||||||
|
@ -21,7 +21,7 @@ namespace Kyoo.Controllers
|
|||||||
public IPeopleRepository PeopleRepository { get; }
|
public IPeopleRepository PeopleRepository { get; }
|
||||||
public IProviderRepository ProviderRepository { get; }
|
public IProviderRepository ProviderRepository { get; }
|
||||||
|
|
||||||
protected LibraryManager(ILibraryRepository libraryRepository,
|
public LibraryManager(ILibraryRepository libraryRepository,
|
||||||
ILibraryItemRepository libraryItemRepository,
|
ILibraryItemRepository libraryItemRepository,
|
||||||
ICollectionRepository collectionRepository,
|
ICollectionRepository collectionRepository,
|
||||||
IShowRepository showRepository,
|
IShowRepository showRepository,
|
||||||
@ -238,9 +238,9 @@ namespace Kyoo.Controllers
|
|||||||
|
|
||||||
public Task Load<T, T2>(T obj, Expression<Func<T, T2>> member)
|
public Task Load<T, T2>(T obj, Expression<Func<T, T2>> member)
|
||||||
where T : class, IResource
|
where T : class, IResource
|
||||||
where T2 : class, IResource
|
where T2 : class, IResource, new()
|
||||||
{
|
{
|
||||||
return (obj, (T2)default) switch
|
return (obj, new T2()) switch
|
||||||
{
|
{
|
||||||
(Show s, Studio) => StudioRepository.Get(x => x.Shows.Any(Utility.ResourceEqualsFunc<Show>(obj)))
|
(Show s, Studio) => StudioRepository.Get(x => x.Shows.Any(Utility.ResourceEqualsFunc<Show>(obj)))
|
||||||
.Then(x => s.Studio = x),
|
.Then(x => s.Studio = x),
|
||||||
@ -260,9 +260,9 @@ namespace Kyoo.Controllers
|
|||||||
|
|
||||||
public Task Load<T, T2>(T obj, Expression<Func<T, ICollection<T2>>> member)
|
public Task Load<T, T2>(T obj, Expression<Func<T, ICollection<T2>>> member)
|
||||||
where T : class, IResource
|
where T : class, IResource
|
||||||
where T2 : class
|
where T2 : class, new()
|
||||||
{
|
{
|
||||||
return (obj, (T2)default) switch
|
return (obj, new T2()) switch
|
||||||
{
|
{
|
||||||
(Library l, ProviderID) => ProviderRepository.GetAll(Utility.ResourceEquals<ProviderID>(obj))
|
(Library l, ProviderID) => ProviderRepository.GetAll(Utility.ResourceEquals<ProviderID>(obj))
|
||||||
.Then(x => l.Providers = x),
|
.Then(x => l.Providers = x),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user