internal ResourceSetWrapper ValidateResourceSet(ResourceSet resourceSet) { ResourceSetWrapper wrapper = null; if (resourceSet != null) { if (this.ResourceSetWrapperCache.TryGetValue(resourceSet.Name, out wrapper)) { return(wrapper); } wrapper = ResourceSetWrapper.CreateResourceSetWrapper(resourceSet, this, new Func <ResourceType, ResourceType>(this.ValidateResourceType)); this.ResourceSetWrapperCache[resourceSet.Name] = wrapper; } return(wrapper); }
/// <summary> /// Validates that <paramref name="resourceSet"/> is cached and read only. /// </summary> /// <param name="resourceSet">Resource set to be validated.</param> /// <returns>Validated resource set, null if the resource set is not supposed to be visible.</returns> internal ResourceSetWrapper ValidateResourceSet(ResourceSet resourceSet) { DebugUtils.CheckNoExternalCallers(); ResourceSetWrapper resourceSetWrapper = null; if (resourceSet != null) { // For IDSP, we want to make sure the metadata object instance stays the same within // a request because we do reference comparisons. Note the provider can return // different metadata instances within the same request. The Validate*() methods // will make sure to return the first cached instance. if (!this.resourceSetCache.TryGetValue(resourceSet.Name, out resourceSetWrapper)) { ValidateResourceSetReadOnly(resourceSet); resourceSetWrapper = ResourceSetWrapper.CreateResourceSetWrapper(resourceSet, this.ValidateResourceType); this.resourceSetCache[resourceSet.Name] = resourceSetWrapper; } } return(resourceSetWrapper); }