/// <summary>Make all the metadata readonly</summary> private void MakeMetadataReadonly() { Debug.Assert(this.metadataRequiresInitialization, "Should only call when initializing metadata."); foreach (ResourceSet container in this.ResourceSets) { container.SetReadOnly(); } foreach (ResourceType resourceType in this.Types) { resourceType.SetReadOnly(); // This will cause Properties collection to be initialized and validated. resourceType.PropertiesDeclaredOnThisType.Count(); } foreach (ServiceOperation operation in this.ServiceOperations) { operation.SetReadOnly(); } // After metadata has been completely loaded, add it to the cache. this.metadata = MetadataCache <ProviderMetadataCacheItem> .AddCacheItem(this.dataServiceInstance.GetType(), this.dataSourceInstance, this.metadata); }
internal void MakeMetadataReadonly() { if (this.metadataRequiresInitialization) { foreach (ResourceSet set in this.ResourceSets) { set.SetReadOnly(); } foreach (ResourceType type in this.Types) { type.SetReadOnly(); type.PropertiesDeclaredOnThisType.Count <ResourceProperty>(); } foreach (ServiceOperation operation in this.ServiceOperations) { operation.SetReadOnly(); } this.metadata = MetadataCache <ProviderMetadataCacheItem> .AddCacheItem(this.dataServiceInstance.GetType(), this.dataSourceInstance, this.metadata); } }