private Type[] SetupPlugins(Registry registry)
{
var pluginTypes = new List<Type>
{
typeof (StatsPlugin),
typeof (ConnectionPlugin)
};
Type[] customPlugins = _configuration.ListPluginTypes() ?? new Type[0];
pluginTypes.AddRange(customPlugins);
registry.Scan(x =>
{
// scan assemblies that we are loading pipelines from
foreach (Type pluginType in pluginTypes)
{
x.AssemblyContainingType(pluginType);
x.WithDefaultConventions();
}
});
// make all plugins singletons
foreach (Type pluginType in pluginTypes)
{
registry
.For(pluginType)
.Singleton();
}
return pluginTypes.ToArray();
}