private Funcstructor(string name, Funcstructor parent, bool containsInstances) { this._ReaderWriterLock = new ReaderWriterLockSlim(); this._RegistryItemState = new Hashtable(); this.Name = name ?? string.Empty; this._Parent = parent; this._ContainsInstances = containsInstances; }
/// <summary> /// Create the default chain LateLoad-LateInstance-Root /// </summary> /// <param name="assemblyWatcherService">The service - can be null, but...</param> /// <returns>the root instance of the default chain.</returns> public static Funcstructor CreateDefault(IAssemblyWatcherService assemblyWatcherService) { var instanceConfiguration = new Funcstructor(FuncstructorConstant.ParentNameLateLoad, null, false); var instanceLateInstance = new Funcstructor(FuncstructorConstant.ParentNameLateInstance, instanceConfiguration, false); var instanceRoot = new Funcstructor(FuncstructorConstant.ParentNameRoot, instanceLateInstance, true); if ((object)assemblyWatcherService == null) { assemblyWatcherService.WireTo(instanceRoot); } return(instanceRoot); }
/// <summary> /// Gets the parent named <paramref name="name"/> /// </summary> /// <param name="name">The name to look for.</param> /// <returns>The parent or NULL.</returns> public IFuncstructorConfigurable GetParent(string name) { if (name == null) { return(this._Parent); } else { for (Funcstructor that = this; that != null; that = that._Parent) { if (that.Name.Equals(name)) { return(that); } } return(null); } }
private ItemState GetItemState(CacheKey cacheKey) { ItemState itemState = null; for (Funcstructor that = this; that != null; that = that._Parent) { that._ReaderWriterLock.EnterReadLock(); try { itemState = (ItemState)that._RegistryItemState[cacheKey]; } finally { that._ReaderWriterLock.ExitReadLock(); } if (itemState != null) { return(itemState); } } return(itemState); }