/// <summary> /// Gets an instance of the specified type /// </summary> /// <param name="type">The type to get</param> /// <returns>The object</returns> public static object Get(Type type) { //first attempt manual registrations if (ManualContainer.HasComponent(type)) { return(_manualContainer[type]); } //if no objects in manual registrations, start configuration-based registrations if (Container.Kernel.HasComponent(type.Name)) { return(Container[type.Name]); } throw new CalidusException("Could not find an appropriate instance of " + type.Name + " to return"); }
/// <summary> /// Checks if the specified type is registered with the factory /// </summary> /// <param name="type">The type</param> /// <returns>True if registered, otherwise false</returns> public static bool Has(Type type) { //first attempt manual registrations if (ManualContainer.HasComponent(type)) { return(true); } //if no objects in manual registrations, start configuration-based registrations if (Container.Kernel.HasComponent(type.Name)) { return(true); } return(false); }
/// <summary> /// Registers a concrete object to be returned when an interface is requested /// </summary> /// <typeparam name="TInterface">The interface</typeparam> /// <param name="obj">The concrete object</param> public static void Register <TInterface>(TInterface obj) { ManualContainer.AddComponentInstance <TInterface>(obj); }