mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-07-09 03:04:20 -04:00
Fixing the run generic method
This commit is contained in:
parent
8597cf34f2
commit
3e0c0db79c
@ -238,6 +238,8 @@ namespace Kyoo
|
|||||||
action();
|
action();
|
||||||
yield break;
|
yield break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
yield return enumerator.Current;
|
||||||
while (enumerator.MoveNext())
|
while (enumerator.MoveNext())
|
||||||
yield return enumerator.Current;
|
yield return enumerator.Current;
|
||||||
}
|
}
|
||||||
@ -254,7 +256,6 @@ namespace Kyoo
|
|||||||
.Where(x =>
|
.Where(x =>
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
// TODO this thing does not work.
|
|
||||||
return x.GetGenericArguments().All(y => y.IsAssignableFrom(generics[i++]));
|
return x.GetGenericArguments().All(y => y.IsAssignableFrom(generics[i++]));
|
||||||
})
|
})
|
||||||
.IfEmpty(() => throw new NullReferenceException($"No method {name} match the generics specified."))
|
.IfEmpty(() => throw new NullReferenceException($"No method {name} match the generics specified."))
|
||||||
|
@ -51,6 +51,8 @@ namespace Kyoo.Controllers
|
|||||||
if (!typeof(IEnumerable).IsAssignableFrom(typeof(T2)))
|
if (!typeof(IEnumerable).IsAssignableFrom(typeof(T2)))
|
||||||
return entry.Reference(member).LoadAsync();
|
return entry.Reference(member).LoadAsync();
|
||||||
|
|
||||||
|
// TODO This is totally the wrong thing. We should run entry.Collection<T>(collectionMember).LoadAsync()
|
||||||
|
// TODO where collectionMember would be member with T2 replaced by it's inner type (IEnumerable<T3>)
|
||||||
Type collectionType = Utility.GetGenericDefinition(typeof(T2), typeof(IEnumerable<>));
|
Type collectionType = Utility.GetGenericDefinition(typeof(T2), typeof(IEnumerable<>));
|
||||||
return Utility.RunGenericMethod<CollectionEntry>(entry, "Collection", collectionType, member).LoadAsync();
|
return Utility.RunGenericMethod<CollectionEntry>(entry, "Collection", collectionType, member).LoadAsync();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user