Resvolution - Booting

This commit is contained in:
Stephan
2016-08-25 15:09:51 +02:00
parent 9949f07a46
commit 9dcc6b285f
48 changed files with 2282 additions and 2753 deletions

View File

@@ -58,6 +58,27 @@ namespace Umbraco.Core.DependencyInjection
return This;
}
/// <summary>
/// Appends types to the collections.
/// </summary>
/// <param name="types">The types to append.</param>
/// <returns>The builder.</returns>
public TBuilder Append(Func<IServiceFactory, IEnumerable<Type>> types)
{
Configure(list =>
{
foreach (var type in types(Container))
{
// would be detected by CollectionBuilderBase when registering, anyways, but let's fail fast
if (typeof(TItem).IsAssignableFrom(type) == false)
throw new InvalidOperationException($"Cannot register type {type.FullName} as it does not inherit from/implement {typeof(TItem).FullName}.");
if (list.Contains(type)) list.Remove(type);
list.Add(type);
}
});
return This;
}
/// <summary>
/// Appends a type after another type.
/// </summary>