Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 1 addition & 13 deletions CommandCore.LightIoC/BasicServiceProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,7 @@ private readonly ConcurrentDictionary<Type, object>
/// <exception cref="InvalidOperationException">If the concrete type is not instantiable. For instance, using an abstract class for the concrete type throws this exception.</exception>
public void Register<S, T>()
{
if (typeof(T).IsAbstract)
{
throw new InvalidOperationException(
$"Type {typeof(T).FullName} may not be abstract. Abstract classes cannot be instantiated, hence not allowed to be registered.");
}

if (!typeof(S).IsAssignableFrom(typeof(T)))
{
throw new InvalidOperationException(
$"Type {typeof(T).FullName} is not assignable to {typeof(S).FullName}");
}

_typeRegistry[typeof(S)] = typeof(T);
Register(typeof(S), typeof(T));
}

public void Register(Type service, Type implementation)
Expand Down