mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
Fixing exception in Layouts when a driver was inherited from a custom base driver, fixes #5509
This commit is contained in:
@@ -68,7 +68,21 @@ namespace Orchard.Layouts.Services {
|
||||
}
|
||||
|
||||
private IEnumerable<IContentPartDriver> GetPartDrivers(string partName) {
|
||||
return _contentPartDrivers.Where(x => x.GetType().BaseType.GenericTypeArguments[0].Name == partName);
|
||||
return _contentPartDrivers.Where(x => GetPartOfDriver(x.GetType().BaseType).Name == partName);
|
||||
}
|
||||
|
||||
private Type GetPartOfDriver(Type type) {
|
||||
var baseType = type;
|
||||
|
||||
while (baseType != null && typeof(IContentPartDriver).IsAssignableFrom(baseType)) {
|
||||
if (baseType.GenericTypeArguments.Any()) {
|
||||
return baseType.GenericTypeArguments[0];
|
||||
}
|
||||
|
||||
baseType = baseType.BaseType;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user