Skip to content

Instantly share code, notes, and snippets.

@dealproc
Created June 25, 2014 19:10
Show Gist options
  • Save dealproc/5dfb780eb8f9dd109924 to your computer and use it in GitHub Desktop.
Save dealproc/5dfb780eb8f9dd109924 to your computer and use it in GitHub Desktop.
Resolve registered types that implement a given generic interface for Autofac
var connectionTypes = _LifetimeScope
.ComponentRegistry
.Registrations
.Where(reg =>
reg.Activator
.LimitType
.GetInterfaces()
.Any(iface =>
iface.IsGenericType && iface.GetGenericTypeDefinition() == typeof(IConnectionEditorViewModel<>)
)
)
.Select(x => x.Activator.LimitType);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment