/// <summary> /// Method is used for geting instace of localContextSingelton. /// </summary> /// <typeparam name="RootType">Type that will be used for initialization of Context</typeparam> /// <param name="newStorage">This object will be used for new storage if LocalContextSingleton /// is not yet initialized</param> /// <returns></returns> public static LocalContextSingleton GetInstance <RootType>(IKeyValueStorage <Guid, object> newStorage) { lock (locker) { if (instance == null) { instance = new LocalContextSingleton(typeof(RootType), newStorage); } } return(instance); }
/// <summary> /// Method is used for geting instace of localContextSingelton. /// </summary> /// <typeparam name="RootType">Type that will be used for initialization of Context</typeparam> /// <returns></returns> public static LocalContextSingleton GetInstance <RootType>() { lock (locker) { if (instance == null) { instance = new LocalContextSingleton(typeof(RootType)); } } return(instance); }
/// <summary> /// Creates new instance of ServerContext type with specified KeyValueStorage /// </summary> public IOGServerContext(IKeyValueStorage <Guid, object> newStorage) { localContext = LocalContextSingleton.GetInstance <RootType>(newStorage); }
/// <summary> /// Creates new instance of ServerContext type /// </summary> public IOGServerContext() { localContext = LocalContextSingleton.GetInstance <RootType>(); }