public void RegisterSingleton(Type type) { if (type == null) { throw new ArgumentNullException(nameof(type)); } var instance = CreateInstance(type, null); var handle = new ServiceHandle(type, instance); mServices.AddOrUpdate(handle, handle); }
public void Register(Type type, object instance) { if (type == null) { throw new ArgumentNullException(nameof(type)); } if (instance == null) { throw new ArgumentNullException(nameof(instance)); } var handle = new ServiceHandle(type, instance); mServices.AddOrUpdate(handle, handle); }
public void Register(Type interfaceType, Type implementationType) { if (interfaceType == null) { throw new ArgumentNullException(nameof(interfaceType)); } if (implementationType == null) { throw new ArgumentNullException(nameof(implementationType)); } var handle = new ServiceHandle(interfaceType, implementationType); mServices.AddOrUpdate(handle, handle); }
public void Register(Type type) { if (type == null) { throw new ArgumentNullException(nameof(type)); } var info = type.GetTypeInfo(); if (info.IsAbstract || info.IsInterface) { throw new ArgumentException($"The provided type \"{type.FullName}\" is an interface or abstract and can't be directly constructed."); } var handle = new ServiceHandle(type); mServices.AddOrUpdate(handle, handle); }
public bool Equals(ServiceHandle other) { return(mTypeHash.Equals(other.mTypeHash)); }