internal void LoadStoreCollection(EdmItemCollection edmItemCollection, MetadataArtifactLoader loader) { StoreItemCollection storeItemCollection = null; IEnumerable <XmlReader> sSpaceXmlReaders = loader.CreateReaders(DataSpace.SSpace); try { // Load the store side, however, only do so if we don't already have one storeItemCollection = new StoreItemCollection( sSpaceXmlReaders, loader.GetPaths(DataSpace.SSpace)); } finally { Helper.DisposeXmlReaders(sSpaceXmlReaders); } // If this entry is getting re-used, make sure that the previous query cache manager gets // cleared up if (_queryCacheManager != null) { _queryCacheManager.Clear(); } // Update the query cache manager reference _queryCacheManager = storeItemCollection.QueryCacheManager; // With the store metadata in place, we can then load the mappings, however, only use it // if we don't already have one // StorageMappingItemCollection storageMappingItemCollection = null; IEnumerable <XmlReader> csSpaceXmlReaders = loader.CreateReaders(DataSpace.CSSpace); try { storageMappingItemCollection = new StorageMappingItemCollection( edmItemCollection, storeItemCollection, csSpaceXmlReaders, loader.GetPaths(DataSpace.CSSpace)); } finally { Helper.DisposeXmlReaders(csSpaceXmlReaders); } var permissionPaths = new List <string>(); loader.CollectFilePermissionPaths(permissionPaths, DataSpace.SSpace); loader.CollectFilePermissionPaths(permissionPaths, DataSpace.CSSpace); FileIOPermission filePermissions = null; if (permissionPaths.Count > 0) { filePermissions = new FileIOPermission(FileIOPermissionAccess.Read, permissionPaths.ToArray()); } UpdateMetadataEntry(storageMappingItemCollection, filePermissions); }
internal void LoadEdmItemCollection(MetadataArtifactLoader loader) { DebugCheck.NotNull(loader); var readers = loader.CreateReaders(DataSpace.CSpace); try { var itemCollection = new EdmItemCollection( readers, loader.GetPaths(DataSpace.CSpace) ); var permissionPaths = new List <string>(); loader.CollectFilePermissionPaths(permissionPaths, DataSpace.CSpace); FileIOPermission filePermissions = null; if (permissionPaths.Count > 0) { filePermissions = new FileIOPermission(FileIOPermissionAccess.Read, permissionPaths.ToArray()); } UpdateMetadataEntry(itemCollection, filePermissions); } finally { Helper.DisposeXmlReaders(readers); } }