public void PortAllBEPsTestsUsingAnUnopenedSource( [Values(BackendProviderType.kXMLWithMemoryOnlyWsMgr)] BackendProviderType sourceType, [Values(BackendProviderType.kXMLWithMemoryOnlyWsMgr, BackendProviderType.kMemoryOnly)] BackendProviderType targetType) { var path = Path.Combine(Path.GetTempPath(), "FieldWorksTest"); if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } var sourceBackendStartupParameters = GenerateBackendStartupParameters(false, sourceType); var targetBackendStartupParameters = GenerateBackendStartupParameters(true, targetType); var sourceGuids = new List <Guid>(); // Set up data source var sourceProjectId = new TestProjectId(sourceBackendStartupParameters.ProjectId.Type, sourceBackendStartupParameters.ProjectId.Path); using (LcmCache sourceCache = LcmCache.CreateCacheWithNewBlankLangProj(sourceProjectId, "en", "fr", "en", new DummyLcmUI(), m_lcmDirectories, new LcmSettings())) { // BEP is a singleton, so we shouldn't call Dispose on it. This will be done // by service locator. var sourceDataSetup = GetMainBEPInterface(sourceCache); sourceCache.ServiceLocator.GetInstance <IUndoStackManager>().Save(); // persist the new db so we can reopen it. sourceDataSetup.LoadDomain(BackendBulkLoadDomain.All); sourceGuids.AddRange(GetAllCmObjects(sourceCache).Select(obj => obj.Guid)); // Collect all source Guids } // Migrate source data to new BEP. IThreadedProgress progressDlg = new DummyProgressDlg(); var targetProjectId = new TestProjectId(targetBackendStartupParameters.ProjectId.Type, null); using (var targetCache = LcmCache.CreateCacheWithNoLangProj(targetProjectId, "en", new DummyLcmUI(), m_lcmDirectories, new LcmSettings())) { // BEP is a singleton, so we shouldn't call Dispose on it. This will be done // by service locator. var targetDataSetup = GetMainBEPInterface(targetCache); targetDataSetup.InitializeFromSource(new TestProjectId(targetBackendStartupParameters.ProjectId.Type, targetBackendStartupParameters.ProjectId.Path), sourceBackendStartupParameters, "en", progressDlg); targetDataSetup.LoadDomain(BackendBulkLoadDomain.All); CompareResults(sourceGuids, targetCache); } sourceGuids.Clear(); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the <see cref="ModelWnd"/> class. /// </summary> /// ------------------------------------------------------------------------------------ public ModelWnd() { InitializeComponent(); m_tvModel.Font = SystemFonts.MenuFont; m_lvModel.Font = SystemFonts.MenuFont; // Add model browsing cache (no data, just model browsing). m_cache = LcmCache.CreateCacheWithNoLangProj(new BrowserProjectId(BackendProviderType.kMemoryOnly, null), "en", new SilentLcmUI(this), FwDirectoryFinder.LcmDirectories, new LcmSettings()); m_mdc = (IFwMetaDataCacheManaged)m_cache.MainCacheAccessor.MetaDataCache; PopulateModelTree(); if (Properties.Settings.Default.ModelWndSplitterLocation > 0) { m_splitter.SplitterDistance = Properties.Settings.Default.ModelWndSplitterLocation; } if (Properties.Settings.Default.ModelWndCol0Width > 0) { m_hdrImplementor.Width = Properties.Settings.Default.ModelWndCol0Width; } if (Properties.Settings.Default.ModelWndCol1Width > 0) { m_hdrId.Width = Properties.Settings.Default.ModelWndCol1Width; } if (Properties.Settings.Default.ModelWndCol2Width > 0) { m_hdrName.Width = Properties.Settings.Default.ModelWndCol2Width; } if (Properties.Settings.Default.ModelWndCol3Width > 0) { m_hdrType.Width = Properties.Settings.Default.ModelWndCol3Width; } if (Properties.Settings.Default.ModelWndCol4Width > 0) { m_hdrSig.Width = Properties.Settings.Default.ModelWndCol4Width; } m_hdrImplementor.Tag = true; m_hdrId.Tag = true; m_hdrName.Tag = true; m_hdrSig.Tag = true; m_hdrType.Tag = true; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Loads the list of all FDO class names from the meta data cache. /// </summary> /// ------------------------------------------------------------------------------------ private static void LoadFDOClassNames() { if (s_allLCMClassNames != null) { return; } using (var threadHelper = new ThreadHelper()) using (LcmCache cache = LcmCache.CreateCacheWithNoLangProj(new BrowserProjectId(BackendProviderType.kMemoryOnly, null), "en", new SilentLcmUI(threadHelper), FwDirectoryFinder.LcmDirectories, new LcmSettings())) { IFwMetaDataCacheManaged mdc = (IFwMetaDataCacheManaged)cache.MainCacheAccessor.MetaDataCache; s_allLCMClassNames = new List <string>(); foreach (int clsid in mdc.GetClassIds()) { s_allLCMClassNames.Add(mdc.GetClassName(clsid)); } s_allLCMClassNames.Sort((x, y) => x.CompareTo(y)); } }