mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +08:00
Registering types as themselves.
This enables scenarios where you want to instantiate a particular type without having to manually resolve all of its dependencies.
This commit is contained in:
@@ -69,7 +69,7 @@ namespace Orchard.Environment.ShellBuilders {
|
|||||||
foreach (var interfaceType in item.Type.GetInterfaces()
|
foreach (var interfaceType in item.Type.GetInterfaces()
|
||||||
.Where(itf => typeof(IDependency).IsAssignableFrom(itf)
|
.Where(itf => typeof(IDependency).IsAssignableFrom(itf)
|
||||||
&& !typeof(IEventHandler).IsAssignableFrom(itf))) {
|
&& !typeof(IEventHandler).IsAssignableFrom(itf))) {
|
||||||
registration = registration.As(interfaceType);
|
registration = registration.As(interfaceType).AsSelf();
|
||||||
if (typeof(ISingletonDependency).IsAssignableFrom(interfaceType)) {
|
if (typeof(ISingletonDependency).IsAssignableFrom(interfaceType)) {
|
||||||
registration = registration.InstancePerMatchingLifetimeScope("shell");
|
registration = registration.InstancePerMatchingLifetimeScope("shell");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user