public void LoadBDTLsAndTheirBDTs(ICctsRepository repository) { foreach (IBdtLibrary bdtl in repository.GetBdtLibraries()) { if (BDTLs.ContainsKey(bdtl.Name)) { BDTLs.Clear(); throw new CacheException("The wizard encountered two BDT libraries having identical names. Please make sure that all BDT libraries within the model have unique names before proceeding with the wizard."); } BDTLs.Add(bdtl.Name, new cBDTLibrary(bdtl.Name, bdtl.Id)); foreach (IBdt bdt in bdtl.Bdts) { if (BDTLs[bdtl.Name].BDTs.ContainsKey(bdt.Name)) { BDTLs[bdtl.Name].BDTs.Clear(); throw new CacheException("The wizard encountered two BDTs within one BDT library having identical names. Please make sure that all BDTs within each BDT library have unique names before proceeding with the wizard."); } BDTLs[bdtl.Name].BDTs.Add(bdt.Name, new cBDT(bdt.Name, bdt.Id, bdt.BasedOn.Id, CheckState.Unchecked)); } } if (BDTLs.Count == 0) { throw new CacheException("The repository did not contain any BDT libraries. Please make sure at least one BDT 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); }