public void LoadBIELsAndTheirABIEs(ICctsRepository repository) { foreach (IBieLibrary biel in repository.GetBieLibraries()) { if (BIELs.ContainsKey(biel.Name)) { BIELs.Clear(); throw new CacheException("The wizard encountered two BIE libraries having identical names. Please make sure that all BIE libraries within the model have unique names before proceeding with the wizard."); } BIELs.Add(biel.Name, new cBIELibrary(biel.Name, biel.Id)); foreach (IAbie abie in biel.Abies) { if (BIELs[biel.Name].ABIEs.ContainsKey(abie.Name)) { BIELs[biel.Name].ABIEs.Clear(); throw new CacheException("The wizard encountered two ABIEs within one BIE library having identical names. Please make sure that all ABIEs within each BIE library have unique names before proceeding with the wizard."); } BIELs[biel.Name].ABIEs.Add(abie.Name, new cABIE(abie.Name, abie.Id, abie.BasedOn.Id)); } } if (BIELs.Count == 0) { throw new CacheException("The repository did not contain any BIE libraries. Please make sure at least one BIE library is present before proceeding with the wizard."); } }
/// <exception cref="Exception">Root schema does not include a BIE schema.</exception> public ImporterContext(ICctsRepository cctsRepository, string rootSchemaPath) { RootSchemaPath = rootSchemaPath; RootSchemaFileName = Path.GetFileName(rootSchemaPath); string inputDirectory = Path.GetDirectoryName(rootSchemaPath) + @"\"; foreach (string schemaLocation in GetIncludedSchemaLocations(rootSchemaPath)) { if (schemaLocation.StartsWith("BusinessInformationEntity")) { BIESchemaPath = inputDirectory + schemaLocation; } else if (schemaLocation.StartsWith("BusinessDataType")) { BDTSchemaPath = inputDirectory + schemaLocation; } } if (BDTSchemaPath == null) { throw new Exception("Root schema does not include a BDT schema."); } if (BIESchemaPath == null) { throw new Exception("Root schema does not include a BIE schema."); } CDTLibrary = cctsRepository.GetCdtLibraries().ElementAt(0); CCLibrary = cctsRepository.GetCcLibraries().ElementAt(0); BDTLibrary = cctsRepository.GetBdtLibraries().ElementAt(0); BIELibrary = cctsRepository.GetBieLibraries().ElementAt(0); PRIMLibrary = cctsRepository.GetPrimLibraries().ElementAt(0); BLibrary = cctsRepository.GetBLibraries().ElementAt(0); }