/// <summary> /// Constructs and initializes a new controller /// </summary> /// <remarks>This <c>IController</c> implementation is a Multiton, /// so you should not call the constructor /// directly, but instead call the static Multiton /// Factory method <c>Controller.getInstance(multitonKey, key => new Controller(key))</c> /// </remarks> /// <param name="key">Key of controller</param> public Controller(string key) { multitonKey = key; InstanceMap.TryAdd(multitonKey, new Lazy <IController>(this)); commandMap = new ConcurrentDictionary <string, Func <ICommand> >(); InitializeController(); }
/// <summary> /// Constructs and initializes a new model /// </summary> /// <remarks> /// <para> /// This <c>IModel</c> implementation is a Multiton, /// so you should not call the constructor /// directly, but instead call the static Multiton /// Factory method <c>Model.getInstance(multitonKey, key => new Model(key))</c> /// </para> /// </remarks> /// <param name="key">Key of model</param> public Model(string key) { multitonKey = key; InstanceMap.TryAdd(key, new Lazy <IModel>(this)); proxyMap = new ConcurrentDictionary <string, IProxy>(); InitializeModel(); }
/// <summary> /// Constructs and initializes a new view /// </summary> /// <remarks> /// <para> /// This <c>IView</c> implementation is a Multiton, /// so you should not call the constructor /// directly, but instead call the static Multiton /// Factory method <c>View.getInstance(multitonKey, key => new View(key))</c> /// </para> /// </remarks> /// <param name="key">Key of view</param> public View(string key) { multitonKey = key; InstanceMap.TryAdd(key, new Lazy <IView>(() => this)); mediatorMap = new ConcurrentDictionary <string, IMediator>(); observerMap = new ConcurrentDictionary <string, IList <IObserver> >(); InitializeView(); }
/// <summary> /// Constructor. /// </summary> /// <remarks> /// <para> /// This <c>IFacade</c> implementation is a Multiton, /// so you should not call the constructor /// directly, but instead call the static Factory method, /// passing the unique key for this instance /// <c>Facade.getInstance( multitonKey, key => new Facade(key) )</c> /// </para> /// </remarks> /// <param name="key">Key of view</param> public Facade(string key) { InitializeNotifier(key); InstanceMap.TryAdd(key, new Lazy <IFacade>(this)); InitializeFacade(); }