Beispiel #1
0
 /// <summary>
 /// Facade Multiton Factory method
 /// </summary>
 /// <param name="key">Key of facade</param>
 /// <param name="factory">the <c>FuncDelegate</c> of the <c>IFacade</c></param>
 /// <returns>the Multiton instance of the Facade</returns>
 public static IFacade GetInstance(string key, Func <string, IFacade> factory)
 {
     return(InstanceMap.GetOrAdd(key, new Lazy <IFacade>(factory(key))).Value);
 }
Beispiel #2
0
 /// <summary>
 /// <c>View</c> Multiton Factory method.
 /// </summary>
 /// <param name="key">Key of view</param>
 /// <param name="factory">the <c>FuncDelegate</c> of the <c>IView</c></param>
 /// <returns>the instance for this Multiton key </returns>
 public static IView GetInstance(string key, Func <string, IView> factory)
 {
     return(InstanceMap.GetOrAdd(key, new Lazy <IView>(() => factory(key))).Value);
 }
 /// <summary>
 /// <c>Controller</c> Multiton Factory method.
 /// </summary>
 /// <param name="key">Key of controller</param>
 /// <param name="factory">the <c>FuncDelegate</c> of the <c>IController</c></param>
 /// <returns>the Multiton instance of <c>Controller</c></returns>
 public static IController GetInstance(string key, Func <string, IController> factory)
 {
     return(InstanceMap.GetOrAdd(key, new Lazy <IController>(factory(key))).Value);
 }
 /// <summary>
 /// <c>Model</c> Multiton Factory method.
 /// </summary>
 /// <param name="key">Key of model</param>
 /// <param name="factory">the <c>FuncDelegate</c> of the <c>IModel</c></param>
 /// <returns>the instance for this Multiton key </returns>
 public static IModel GetInstance(string key, Func <string, IModel> factory)
 {
     return(InstanceMap.GetOrAdd(key, new Lazy <IModel>(factory(key))).Value);
 }