/// <summary> /// Registers the specified factory. /// </summary> /// <typeparam name="TInterface">The type of the interface.</typeparam> /// <param name="factory">The factory.</param> public virtual void Register <TInterface>(Func <TInterface> factory) { _serviceRegs[typeof(TInterface)] = new ServiceRegistrationModel(typeof(TInterface), factory); }
/// <summary> /// Registers singleton instance. /// </summary> /// <typeparam name="TInterface">The type of the interface.</typeparam> /// <typeparam name="TService">The type of the service.</typeparam> public virtual void RegisterSingleton <TInterface, TService>() where TService : class { _serviceRegs[typeof(TInterface)] = new ServiceRegistrationModel(typeof(TInterface), typeof(TService), true); }
/// <summary> /// Registers single instance. /// </summary> /// <typeparam name="TInterface">The type of the interface.</typeparam> /// <param name="instance">The instance to register.</param> public virtual void RegisterInstance <TInterface>(object instance) { _serviceRegs[typeof(TInterface)] = new ServiceRegistrationModel(typeof(TInterface), instance); }
public async Task <IActionResult> Post([FromBody] ServiceRegistrationModel serviceRegistration) { var serviceId = await _registryManager.RegisterService(serviceRegistration.ServiceTag, serviceRegistration.ServiceUrl); return(Ok(serviceId)); }