public MetadataLoadResult LoadMetadata(string inputFile) { var loader = new MetadataLoader(this); bool loaded = false; EdmItemCollection edmItemCollection = loader.CreateEdmItemCollection(inputFile); StoreItemCollection storeItemCollection = null; if (loader.TryCreateStoreItemCollection(inputFile, out storeItemCollection)) { StorageMappingItemCollection storageMappingItemCollection; if (loader.TryCreateStorageMappingItemCollection(inputFile, edmItemCollection, storeItemCollection, out storageMappingItemCollection)) { loaded = true; } } if (loaded == false) { throw new Exception("Cannot load a metadata from the file " + inputFile); } var mappingMetadata = LoadMappingMetadata(inputFile); var mappingNode = mappingMetadata.Item1; var nsmgr = mappingMetadata.Item2; var allEntitySets = storeItemCollection.GetAllEntitySets(); return(new MetadataLoadResult { EdmItems = edmItemCollection, PropertyToColumnMapping = BuildEntityMappings(mappingNode, nsmgr, edmItemCollection.GetItems <EntityType>(), edmItemCollection.GetAllEntitySets(), allEntitySets), ManyToManyMappings = BuildManyToManyMappings(mappingNode, nsmgr, edmItemCollection.GetAllAssociationSets(), allEntitySets), TphMappings = BuildTPHMappings(mappingNode, nsmgr, edmItemCollection.GetItems <EntityType>(), edmItemCollection.GetAllEntitySets(), allEntitySets) }); }