• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# IDomainObjectDTORepository类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中IDomainObjectDTORepository的典型用法代码示例。如果您正苦于以下问题:C# IDomainObjectDTORepository类的具体用法?C# IDomainObjectDTORepository怎么用?C# IDomainObjectDTORepository使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IDomainObjectDTORepository类属于命名空间,在下文中一共展示了IDomainObjectDTORepository类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: PerformMigration

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Change any bogus non-owning footnote links in the vernacular (but NOT in the BT)
		/// to be owning links
		/// </summary>
		/// <param name="domainObjectDtoRepository">
		/// Repository of all CmObject DTOs available for one migration step.
		/// </param>
		/// ------------------------------------------------------------------------------------
		public void PerformMigration(IDomainObjectDTORepository domainObjectDtoRepository)
		{
			DataMigrationServices.CheckVersionNumber(domainObjectDtoRepository, 7000034);

			foreach (var scrTxtPara in domainObjectDtoRepository.AllInstancesSansSubclasses("ScrTxtPara"))
			{
				XElement para = XElement.Parse(scrTxtPara.Xml);
				XElement contents = para.Element("Contents");
				if (contents == null)
					continue;
				XElement str = contents.Element("Str");
				if (str == null)
					continue;

				foreach (XElement run in str.Elements("Run"))
				{
					XAttribute linkAttr = run.Attribute("link");
					if (linkAttr == null)
						continue; // Run doesn't contain an unowned hot-link
					XAttribute ownedLinkAttr = new XAttribute("ownlink", linkAttr.Value);
					run.Add(ownedLinkAttr);
					linkAttr.Remove();
					DataMigrationServices.UpdateDTO(domainObjectDtoRepository, scrTxtPara, para.ToString());
				}
			}

			DataMigrationServices.IncrementVersionNumber(domainObjectDtoRepository);
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:37,代码来源:DataMigration7000035.cs


示例2: PerformMigration

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Change all guids to lowercase to help the Chorus diff/merge code.
		/// </summary>
		/// ------------------------------------------------------------------------------------
		public void PerformMigration(IDomainObjectDTORepository domainObjectDtoRepository)
		{
			DataMigrationServices.CheckVersionNumber(domainObjectDtoRepository, 7000024);

			const string dateCreated = "DateCreated";
			var properties = new List<string> { dateCreated, "DateModified" };

			ConvertClassAndSubclasses(domainObjectDtoRepository, domainObjectDtoRepository.AllInstancesWithSubclasses("CmProject"), properties); // Tested
			ConvertClassAndSubclasses(domainObjectDtoRepository, domainObjectDtoRepository.AllInstancesWithSubclasses("CmMajorObject"), properties); // Tested
			ConvertClassAndSubclasses(domainObjectDtoRepository, domainObjectDtoRepository.AllInstancesWithSubclasses("CmPossibility"), properties); // Tested
			ConvertClassAndSubclasses(domainObjectDtoRepository, domainObjectDtoRepository.AllInstancesWithSubclasses("CmAnnotation"), properties); // Tested
			ConvertClassAndSubclasses(domainObjectDtoRepository, domainObjectDtoRepository.AllInstancesWithSubclasses("StJournalText"), properties); // Tested
			ConvertClassAndSubclasses(domainObjectDtoRepository, domainObjectDtoRepository.AllInstancesWithSubclasses("LexEntry"), properties); // Tested
			ConvertClassAndSubclasses(domainObjectDtoRepository, domainObjectDtoRepository.AllInstancesWithSubclasses("RnGenericRec"), properties); // Tested
			// Since ScrScriptureNote derives from CmBaseAnnotation, which has already had it DateCreated & DateModified updated,
			// we have to clear those two out of the dictioanry, or they will be updated twice, and the test on ScrScriptureNote will fail.
			properties.Clear();
			properties.Add("DateResolved");
			ConvertClassAndSubclasses(domainObjectDtoRepository, domainObjectDtoRepository.AllInstancesWithSubclasses("ScrScriptureNote"), properties); // Tested
			properties.Clear();
			properties.Add(dateCreated);
			ConvertClassAndSubclasses(domainObjectDtoRepository, domainObjectDtoRepository.AllInstancesWithSubclasses("ScrDraft"), properties);
			properties.Clear();
			properties.Add("RunDate");
			ConvertClassAndSubclasses(domainObjectDtoRepository, domainObjectDtoRepository.AllInstancesWithSubclasses("ScrCheckRun"), properties);

			DataMigrationServices.IncrementVersionNumber(domainObjectDtoRepository);
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:33,代码来源:DataMigration7000025.cs


示例3: PerformMigration

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Makes LexEntries be unowned.
		/// </summary>
		/// <param name="domainObjectDtoRepository">
		/// Repository of all CmObject DTOs available for one migration step.
		/// </param>
		/// <remarks>
		/// The method must add/remove/update the DTOs to the repository,
		/// as it adds/removes objects as part of it work.
		///
		/// Implementors of this interface should ensure the Repository's
		/// starting model version number is correct for the step.
		/// Implementors must also increment the Repository's model version number
		/// at the end of its migration work.
		///
		/// The method also should normally modify the xml string(s)
		/// of relevant DTOs, since that string will be used by the main
		/// data migration calling client (ie. BEP).
		/// </remarks>
		/// ------------------------------------------------------------------------------------
		public void PerformMigration(IDomainObjectDTORepository domainObjectDtoRepository)
		{
			DataMigrationServices.CheckVersionNumber(domainObjectDtoRepository, 7000027);

			var lexDbDto = domainObjectDtoRepository.AllInstancesSansSubclasses("LexDb").First();
			var lexDb = XElement.Parse(lexDbDto.Xml);
			var entries = lexDb.Element("Entries");
			if (entries != null)
			{
				entries.Remove();
				DataMigrationServices.UpdateDTO(domainObjectDtoRepository, lexDbDto, lexDb.ToString());
			}

			foreach (var entryDto in domainObjectDtoRepository.AllInstancesSansSubclasses("LexEntry"))
			{
				XElement entry = XElement.Parse(entryDto.Xml);
				var ownerAttr = entry.Attribute("ownerguid");
				if (ownerAttr != null)
				{
					ownerAttr.Remove();
					DataMigrationServices.UpdateDTO(domainObjectDtoRepository, entryDto, entry.ToString());
				}
			}

			DataMigrationServices.IncrementVersionNumber(domainObjectDtoRepository);
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:47,代码来源:DataMigration7000028.cs


示例4: PerformMigration

		public void PerformMigration(IDomainObjectDTORepository domainObjectDtoRepository)
		{
			DataMigrationServices.CheckVersionNumber(domainObjectDtoRepository, 7000062);

			var wmbLangProjList = domainObjectDtoRepository.AllInstancesSansSubclasses("LangProject");
			var wmbLangProj = wmbLangProjList.First();
			var wmbLangProjElt = XElement.Parse(wmbLangProj.Xml);
			// get the default vernacular ws - it's the 1st in the list of current ones.
			var vernWss = wmbLangProjElt.Element("CurVernWss"); // has to be only one
			// a new project migrates before adding writing systems to the cache, so if there are no CurVernWss, bail out
			if (vernWss != null)
			{
				var vernWssUni = vernWss.Element("Uni"); // only one
				var vernWsList = vernWssUni.Value.Split(' '); // at least one
				var vernDefault = vernWsList[0]; // the default

				// Create the new property
				var sb = new StringBuilder();
				sb.Append("<HomographWs>");
				sb.AppendFormat("<Uni>{0}</Uni>", vernDefault);
				sb.Append("</HomographWs>");
				var hgWsElt = XElement.Parse(sb.ToString());
				wmbLangProjElt.Add(hgWsElt);
				DataMigrationServices.UpdateDTO(domainObjectDtoRepository, wmbLangProj, wmbLangProjElt.ToString());
			}

			DataMigrationServices.IncrementVersionNumber(domainObjectDtoRepository);
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:28,代码来源:DataMigration7000063.cs


示例5: DeleteWeatherListAndField

		/// <summary>
		/// The Weather list is never used, so delete it (and remove any empty Weather elements
		/// from the RnGenericRec elements).
		/// </summary>
		private void DeleteWeatherListAndField(IDomainObjectDTORepository repoDTO)
		{
			// Remove the Weather list.
			DomainObjectDTO dtoLP = GetDtoLangProj(repoDTO);
			string sWeatherListGuid = RemoveWeatherConditionsElement(dtoLP).ToLowerInvariant();
			repoDTO.Update(dtoLP);
			DomainObjectDTO dtoDeadList = null;
			foreach (var dto in repoDTO.AllInstancesWithSubclasses("CmPossibilityList"))
			{
				if (dto.Guid.ToLowerInvariant() == sWeatherListGuid)
				{
					dtoDeadList = dto;
					break;
				}
			}
			List<DomainObjectDTO> rgdtoDead = new List<DomainObjectDTO>();
			GatherDeadObjects(repoDTO, dtoDeadList, rgdtoDead);
			foreach (var dto in rgdtoDead)
				repoDTO.Remove(dto);

			// Remove any empty Weather elements in the RnGenericRec objects.
			foreach (var dto in repoDTO.AllInstancesWithSubclasses("RnGenericRec"))
			{
				string sXml = dto.Xml;
				int idx = sXml.IndexOf("<Weather");
				if (idx > 0)
				{
					dto.Xml = RemoveEmptyWeather(sXml, idx);
					repoDTO.Update(dto);
				}
			}
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:36,代码来源:DataMigration7000017.cs


示例6: PerformMigration

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Changes all StFootnotes to ScrFootnotes
		/// </summary>
		/// <param name="domainObjectDtoRepository">
		/// Repository of all CmObject DTOs available for one migration step.
		/// </param>
		/// <remarks>
		/// The method must add/remove/update the DTOs to the repository,
		/// as it adds/removes objects as part of it work.
		///
		/// Implementors of this interface should ensure the Repository's
		/// starting model version number is correct for the step.
		/// Implementors must also increment the Repository's model version number
		/// at the end of its migration work.
		///
		/// The method also should normally modify the xml string(s)
		/// of relevant DTOs, since that string will be used by the main
		/// data migration calling client (ie. BEP).
		/// </remarks>
		/// ------------------------------------------------------------------------------------
		public void PerformMigration(IDomainObjectDTORepository domainObjectDtoRepository)
		{
			DataMigrationServices.CheckVersionNumber(domainObjectDtoRepository, 7000002);

			var footnotesToChangeClasses = new List<DomainObjectDTO>();
			foreach (var footnote in domainObjectDtoRepository.AllInstancesSansSubclasses("StFootnote"))
			{
				XElement footnoteEl = XElement.Parse(footnote.Xml);
				footnoteEl.Attribute("class").Value = "ScrFootnote";

				// Add the empty ScrFootnote element to the ScrFootnote
				footnoteEl.Add(new XElement("ScrFootnote"));

				// Update the object XML
				footnote.Xml = footnoteEl.ToString();
				footnote.Classname = "ScrFootnote";
				footnotesToChangeClasses.Add(footnote);
			}

			// Udate the repository
			var startingStructure = new ClassStructureInfo("StText", "StFootnote");
			var endingStructure = new ClassStructureInfo("StFootnote", "ScrFootnote");
			foreach (var changedPara in footnotesToChangeClasses)
				domainObjectDtoRepository.Update(changedPara,
					startingStructure,
					endingStructure);

			DataMigrationServices.IncrementVersionNumber(domainObjectDtoRepository);
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:50,代码来源:DataMigration7000003.cs


示例7: VerifyReplace

		private void VerifyReplace(IDomainObjectDTORepository dtoRepos, string guid, bool expectReplace, int numOfPubs)
		{
			var dto = dtoRepos.GetDTO(guid);
			var xElt = XElement.Parse(dto.Xml);
			Assert.That(xElt.Attribute("class").Value == "LexEntry", "Giud not representing a LexEntry after migration to 7000041.");
			var hasDoNotShow = xElt.Element("DoNotShowMainEntryIn");
			string expect = "";
			if (!expectReplace)
				expect = "not ";
			Assert.That(expectReplace == (hasDoNotShow != null),
				"LexEntry " + guid + " did " + expect + "expect ExcludeAsHeadword to be replaced by DoNotShowMainEntryIn, but it didn't happen in migration to 7000041.");
			if (expectReplace)
			{ // Check that each publication is referenced
				var noShows = SurrogatesIn(xElt, "DoNotShowMainEntryIn", numOfPubs);
				var dtoPubist = dtoRepos.GetDTO(CmPossibilityListTags.kguidPublicationsList.ToString());
				Assert.That(dtoPubist != null, "This project has no Publications list after migration 7000041");
				var xPubist = XElement.Parse(dtoPubist.Xml);
				var cfElements = SurrogatesIn(xPubist, "Possibilities", numOfPubs);
				foreach (var xObj in cfElements)
				{	// there must be 1 to 1 map of objsur's in hasDoNotShow and xPubist
					string pubGuid = xObj.Attribute("guid").Value;
					int n = 0;
					foreach (var yObj in noShows)
					{
						if (pubGuid == yObj.Attribute("guid").Value)
						{
							Assert.That(yObj.Attribute("t").Value == "r", "7000041 Migrated test XML pub list items are not references");
							break;
						}
					}
				}
			}
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:33,代码来源:DataMigration7000041Tests.cs


示例8: PerformMigration

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Perform one increment migration step.
		///
		/// In this case, the migration is not related to a model change,
		/// but is a simple data change that removes the class elements in the xml.
		/// The end resujlt xml will have the top-level 'rt' element and zero, or more,
		/// property level elements.
		/// </summary>
		/// ------------------------------------------------------------------------------------
		public void PerformMigration(IDomainObjectDTORepository domainObjectDtoRepository)
		{
			DataMigrationServices.CheckVersionNumber(domainObjectDtoRepository, 7000014);

			// No. We need to convert all instances, even if they are no longer part of the model.
			// DM19, for example, removes LgWritingSystem instances and the class form the model,
			// but it tries to access the data as if it had been properly processed by DM15,
			// *but* this code would leave out LgWritingSystem instnaces form being processed here.
			//foreach (var dto in domainObjectDtoRepository.AllInstancesWithSubclasses("CmObject"))
			foreach (var dto in domainObjectDtoRepository.AllInstances())
			{
				var rtElement = XElement.Parse(dto.Xml);
				// Removes all current child nodes (class level),
				// and replaces them with the old property nodes (if any).
#if !__MonoCS__
				rtElement.ReplaceNodes(rtElement.Elements().Elements());
				dto.Xml = rtElement.ToString();
#else // FWNX-165: work around mono bug https://bugzilla.novell.com/show_bug.cgi?id=592435
				var copy = new XElement(rtElement);
				copy.ReplaceNodes(rtElement.Elements().Elements());
				dto.Xml = copy.ToString();
#endif
				domainObjectDtoRepository.Update(dto);
			}

			DataMigrationServices.IncrementVersionNumber(domainObjectDtoRepository);
		}
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:37,代码来源:DataMigration7000015.cs


示例9: PerformMigration

		public void PerformMigration(IDomainObjectDTORepository domainObjectDtoRepository)
		{
			DataMigrationServices.CheckVersionNumber(domainObjectDtoRepository, 7000050);

			var newGuidValue = Guid.NewGuid().ToString().ToLowerInvariant();
			const string className = "LangProject";
			var lpDto = domainObjectDtoRepository.AllInstancesSansSubclasses(className).First();
			var ownedDtos = domainObjectDtoRepository.GetDirectlyOwnedDTOs(lpDto.Guid).ToList();
			var data = lpDto.Xml;
			domainObjectDtoRepository.Remove(lpDto); // It is pretty hard to change an immutable Guid identifier in BEP-land, so nuke it, and make a new one.

			var lpElement = XElement.Parse(data);
			lpElement.Attribute("guid").Value = newGuidValue;
			var newLpDto = new DomainObjectDTO(newGuidValue, className, lpElement.ToString());
			domainObjectDtoRepository.Add(newLpDto);

			// Change ownerguid attr for each owned item to new guid.
			foreach (var ownedDto in ownedDtos)
			{
				var ownedElement = XElement.Parse(ownedDto.Xml);
				ownedElement.Attribute("ownerguid").Value = newGuidValue;
				ownedDto.Xml = ownedElement.ToString();
				domainObjectDtoRepository.Update(ownedDto);
			}

			DataMigrationServices.IncrementVersionNumber(domainObjectDtoRepository);
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:27,代码来源:DataMigration7000051.cs


示例10: PerformMigration

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Looks for CmFile objects included in LangProject. If found, will look for CmFile in
		/// correct location and replace reference on CmPicture with that new CmFile.
		/// </summary>
		/// <param name="repoDto">
		/// Repository of all CmObject DTOs available for one migration step.
		/// </param>
		/// <remarks>
		/// Implementors of this interface should ensure the Repository's
		/// starting model version number is correct for the step.
		/// Implementors must also increment the Repository's model version number
		/// at the end of its migration work.
		///
		/// The method also should normally modify the xml string(s)
		/// of relevant DTOs, since that string will be used by the main
		/// data migration calling client (ie. BEP).
		/// </remarks>
		/// ------------------------------------------------------------------------------------
		public void PerformMigration(IDomainObjectDTORepository repoDto)
		{
			DataMigrationServices.CheckVersionNumber(repoDto, 7000033);
			var langProj = repoDto.AllInstancesSansSubclasses("LangProject").First();
			var langProjElement = XElement.Parse(langProj.Xml);
			var pictures = langProjElement.Element("Pictures");

			if (pictures != null && pictures.Elements().Count() > 1)
			{
				DomainObjectDTO folder = null;
				bool foundFiles = false;
				foreach (var x in pictures.Elements())
				{
					var xObj = repoDto.GetDTO(x.Attribute("guid").Value);
					if (xObj.Classname == "CmFolder")
					{
						// empty folders can just be removed
						var xObjElement = XElement.Parse(xObj.Xml);
						if (xObjElement.Element("Files") == null)
							DataMigrationServices.RemoveIncludingOwnedObjects(repoDto, xObj, true);
						else if (folder == null)
							folder = xObj;
						else
							MoveFileReferences(repoDto, langProj, xObj, folder);
					}
					else
						foundFiles = true;
				}

				if (folder != null && foundFiles)
					RemoveInvalidFiles(repoDto, langProj, folder);

			}
			DataMigrationServices.IncrementVersionNumber(repoDto);
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:54,代码来源:DataMigration7000034.cs


示例11: PerformMigration

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Changes all StTxtParas that are owned by Scripture to be ScrTxtParas
		/// </summary>
		/// <param name="domainObjectDtoRepository">
		/// Repository of all CmObject DTOs available for one migration step.
		/// </param>
		/// <remarks>
		/// The method must add/remove/update the DTOs to the repository,
		/// as it adds/removes objects as part of it work.
		///
		/// Implementors of this interface should ensure the Repository's
		/// starting model version number is correct for the step.
		/// Implementors must also increment the Repository's model version number
		/// at the end of its migration work.
		///
		/// The method also should normally modify the xml string(s)
		/// of relevant DTOs, since that string will be used by the main
		/// data migration calling client (ie. BEP).
		/// </remarks>
		/// ------------------------------------------------------------------------------------
		public void PerformMigration(IDomainObjectDTORepository domainObjectDtoRepository)
		{
			DataMigrationServices.CheckVersionNumber(domainObjectDtoRepository, 7000001);

			var parasToChangeClasses = new List<DomainObjectDTO>();
			foreach (var stTxtPara in domainObjectDtoRepository.AllInstancesSansSubclasses("StTxtPara"))
			{
				var paraOwner = domainObjectDtoRepository.GetOwningDTO(stTxtPara);
				if (paraOwner.Classname != "StText" && paraOwner.Classname != "StFootnote")
				{
					continue; // Paragraph is not owned by an StText or StFootnote (shouldn't ever happen)
				}

				var textOwner = domainObjectDtoRepository.GetOwningDTO(paraOwner);
				if (textOwner.Classname != "ScrBook" && textOwner.Classname != "ScrSection")
				{
					continue; // StText is not part of Scripture, don't change.
				}
				// Its one of the paragraphs that we care about. We just need to change the
				// class in the xml to be a ScrTxtPara and change the objectsByClass map.
				DataMigrationServices.ChangeToSubClass(stTxtPara, "StTxtPara", "ScrTxtPara");
				parasToChangeClasses.Add(stTxtPara);
			}

			// Udate the repository
			var startingStructure = new ClassStructureInfo("StPara", "StTxtPara");
			var endingStructure = new ClassStructureInfo("StTxtPara", "ScrTxtPara");
			foreach (var changedPara in parasToChangeClasses)
				domainObjectDtoRepository.Update(changedPara,
					startingStructure,
					endingStructure);

			DataMigrationServices.IncrementVersionNumber(domainObjectDtoRepository);
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:55,代码来源:DataMigration7000002.cs


示例12: PerformMigration

		/// <summary>
		/// Remove the owningFlid attribute from every "rt" element.
		/// </summary>
		/// <param name="domainObjectDtoRepository"></param>
		public void PerformMigration(IDomainObjectDTORepository domainObjectDtoRepository)
		{
			DataMigrationServices.CheckVersionNumber(domainObjectDtoRepository, 7000008);

			foreach (var dto in domainObjectDtoRepository.AllInstancesWithValidClasses())
			{
				byte[] contents = dto.XmlBytes;
				int index = contents.IndexOfSubArray(owningFlidTag);
				if (index >= 0)
				{
					contents = contents.ReplaceSubArray(index,
						Array.IndexOf(contents, closeQuote, index + owningFlidTag.Length) - index + 1,
						new byte[0]);
				}
				int index2 = contents.IndexOfSubArray(owningOrdTag);
				if (index2 >= 0)
				{
					contents = contents.ReplaceSubArray(index2,
						Array.IndexOf(contents, closeQuote, index2 + owningOrdTag.Length) - index2 + 1,
						new byte[0]);
				}
				if (index >= 0 || index2 >= 0)
				{
					DataMigrationServices.UpdateDTO(domainObjectDtoRepository, dto, contents);
				}
			}
			DataMigrationServices.IncrementVersionNumber(domainObjectDtoRepository);
		}
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:32,代码来源:DataMigration7000009.cs


示例13: PerformMigration

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Perform one increment migration step.
		/// </summary>
		/// <param name="domainObjectDtoRepository">
		/// Repository of all CmObject DTOs available for one migration step.
		/// </param>
		/// <remarks>
		/// The method must add/remove/update the DTOs to the repository,
		/// as it adds/removes objects as part of it work.
		///
		/// Implementors of this interface should ensure the Repository's
		/// starting model version number is correct for the step.
		/// Implementors must also increment the Repository's model version number
		/// at the end of its migration work.
		///
		/// The method also should normally modify the xml string(s)
		/// of relevant DTOs, since that string will be used by the main
		/// data migration calling client (ie. BEP).
		/// </remarks>
		/// ------------------------------------------------------------------------------------
		public void PerformMigration(IDomainObjectDTORepository domainObjectDtoRepository)
		{
			DataMigrationServices.CheckVersionNumber(domainObjectDtoRepository, 7000000);

			DataMigrationServices.Delint(domainObjectDtoRepository);

			var lpDto = domainObjectDtoRepository.AllInstancesSansSubclasses("LangProject").First();
			// 1. Remove property from LangProg.
			var lpElement = XElement.Parse(lpDto.Xml);
			lpElement.Descendants("WordformInventory").Remove();
			DataMigrationServices.UpdateDTO(domainObjectDtoRepository, lpDto, lpElement.ToString());

			// 2. Remove three owner-related attributes from each WfiWordform.
			// (There may be zero, or more, instances to upgrade.)
			foreach (var wordformDto in domainObjectDtoRepository.AllInstancesSansSubclasses("WfiWordform"))
			{
				var wfElement = XElement.Parse(wordformDto.Xml);
				wfElement.Attribute("ownerguid").Remove();
				var flidAttr = wfElement.Attribute("owningflid");
				if (flidAttr != null)
					flidAttr.Remove();
				var ordAttr = wfElement.Attribute("owningord");
				if (ordAttr != null)
					ordAttr.Remove();
				DataMigrationServices.UpdateDTO(domainObjectDtoRepository, wordformDto, wfElement.ToString());
			}

			// 3. Remove WordformInventory instance.
			domainObjectDtoRepository.Remove(
				domainObjectDtoRepository.AllInstancesSansSubclasses("WordformInventory").First());

			// There are no references to the WFI, so don't fret about leaving dangling refs to it.

			DataMigrationServices.IncrementVersionNumber(domainObjectDtoRepository);
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:56,代码来源:DataMigration7000001.cs


示例14: VerifyEntryRef

		private XElement[] VerifyEntryRef(IDomainObjectDTORepository dtoRepos, string guid, int cfCount, int showComplexFormsInCount)
		{
			var dto = dtoRepos.GetDTO(guid);
			var xElt = XElement.Parse(dto.Xml);
			SurrogatesIn(xElt, "ComponentLexemes", cfCount);
			SurrogatesIn(xElt, "PrimaryLexemes", showComplexFormsInCount);
			var cfElements = SurrogatesIn(xElt, "ShowComplexFormsIn", showComplexFormsInCount);
			return cfElements.ToArray();
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:9,代码来源:DataMigration7000040Tests.cs


示例15: RemoveUnwantedOverlays

		private void RemoveUnwantedOverlays(IDomainObjectDTORepository repoDTO, List<DomainObjectDTO> collectOverlaysToRemove)
		{
			DomainObjectDTO dtoLP = GetDtoLangProj(repoDTO);
			foreach (var dto in collectOverlaysToRemove)
			{
				RemoveOverlayElement(dtoLP, dto.Guid);
				repoDTO.Remove(dto);
			}
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:9,代码来源:DataMigration7000017.cs


示例16: CheckDtoRemoved

		internal static void CheckDtoRemoved(IDomainObjectDTORepository dtoRepos, DomainObjectDTO goner)
		{
			DomainObjectDTO dto;
			if (dtoRepos.TryGetValue(goner.Guid, out dto))
			{
				Assert.Fail("Still has deleted (or zombie) DTO.");
			}
			Assert.IsTrue(((DomainObjectDtoRepository)dtoRepos).Goners.Contains(goner));
		}
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:9,代码来源:DataMigrationTestServices.cs


示例17: PerformMigration

		/// <summary>
		/// Updates the Data Notebook RecordTypes possibilities to use specific GUIDs.
		/// </summary>
		/// <param name="domainObjectDtoRepository">Repository of all CmObject DTOs available for one migration step.</param>
		public void PerformMigration(IDomainObjectDTORepository domainObjectDtoRepository)
		{
			DataMigrationServices.CheckVersionNumber(domainObjectDtoRepository, 7000010);

			DomainObjectDTO nbkDto = domainObjectDtoRepository.AllInstancesSansSubclasses("RnResearchNbk").First();
			XElement nbkElem = XElement.Parse(nbkDto.Xml);
			var recTypesGuid = (string) nbkElem.XPathSelectElement("RnResearchNbk/RecTypes/objsur").Attribute("guid");
			var stack = new Stack<DomainObjectDTO>(domainObjectDtoRepository.GetDirectlyOwnedDTOs(recTypesGuid));
			IEnumerable<DomainObjectDTO> recDtos = domainObjectDtoRepository.AllInstancesSansSubclasses("RnGenericRec");
			IEnumerable<DomainObjectDTO> overlayDtos = domainObjectDtoRepository.AllInstancesSansSubclasses("CmOverlay");
			while (stack.Count > 0)
			{
				DomainObjectDTO dto = stack.Pop();
				foreach (DomainObjectDTO childDto in domainObjectDtoRepository.GetDirectlyOwnedDTOs(dto.Guid))
					stack.Push(childDto);
				XElement posElem = XElement.Parse(dto.Xml);
				XElement uniElem = posElem.XPathSelectElement("CmPossibility/Abbreviation/AUni[@ws='en']");
				if (uniElem != null)
				{
					string newGuid = null;
					switch (uniElem.Value)
					{
						case "Con":
							newGuid = "B7B37B86-EA5E-11DE-80E9-0013722F8DEC";
							break;
						case "Intv":
							newGuid = "B7BF673E-EA5E-11DE-9C4D-0013722F8DEC";
							break;
						case "Str":
							newGuid = "B7C8F092-EA5E-11DE-8D7D-0013722F8DEC";
							break;
						case "Uns":
							newGuid = "B7D4DC4A-EA5E-11DE-867C-0013722F8DEC";
							break;
						case "Lit":
							newGuid = "B7E0C7F8-EA5E-11DE-82CC-0013722F8DEC";
							break;
						case "Obs":
							newGuid = "B7EA5156-EA5E-11DE-9F9C-0013722F8DEC";
							break;
						case "Per":
							newGuid = "B7F63D0E-EA5E-11DE-9F02-0013722F8DEC";
							break;
						case "Ana":
							newGuid = "82290763-1633-4998-8317-0EC3F5027FBD";
							break;
					}
					if (newGuid != null)
						DataMigrationServices.ChangeGuid(domainObjectDtoRepository, dto, newGuid, recDtos.Concat(overlayDtos));
				}
			}

			DomainObjectDTO recTypesDto = domainObjectDtoRepository.GetDTO(recTypesGuid);
			DataMigrationServices.ChangeGuid(domainObjectDtoRepository, recTypesDto, "D9D55B12-EA5E-11DE-95EF-0013722F8DEC", overlayDtos);
			DataMigrationServices.IncrementVersionNumber(domainObjectDtoRepository);
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:60,代码来源:DataMigration7000011.cs


示例18: UpdateDTO

		/// <summary>
		/// Rest the xml in the DTO and register the DTO as udated with the repository.
		/// Use this overload only if the class name is NOT changing.
		/// </summary>
		/// <remarks>
		/// There is no validation of the xml, other than making sure it is not null,
		/// or an emty string.
		/// </remarks>
		internal static void UpdateDTO(IDomainObjectDTORepository dtoRepos,
			DomainObjectDTO dirtball, byte[] newXmlBytes)
		{
			if (dtoRepos == null) throw new ArgumentNullException("dtoRepos");
			if (dirtball == null) throw new ArgumentNullException("dirtball");
			if (newXmlBytes == null || newXmlBytes.Length == 0) throw new ArgumentNullException("newXmlBytes");

			dirtball.XmlBytes = newXmlBytes;
			dtoRepos.Update(dirtball);
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:18,代码来源:DataMigrationServices.cs


示例19: ChangeClassOfOwnerAndChildren

		void ChangeClassOfOwnerAndChildren(IDomainObjectDTORepository dtoRepo, DomainObjectDTO dtoToChange, string oldClassname, string newClassname)
		{
			// bail out if we've already changed the class name (assume we've already changed its children too).
			if (!TryChangeOwnerClass(dtoRepo, dtoToChange, oldClassname, newClassname))
				return;
			foreach (var dtoChild in dtoRepo.GetDirectlyOwnedDTOs(dtoToChange.Guid))
			{
				ChangeClassOfOwnerAndChildren(dtoRepo, dtoChild, oldClassname, newClassname);
			}
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:10,代码来源:DataMigration7000057.cs


示例20: PerformMigration

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Change model for Data Notebook to combine the RnEvent and RnAnalysis classes
		/// into RnGenericRec
		/// </summary>
		/// <param name="domainObjectDtoRepository">
		/// Repository of all CmObject DTOs available for one migration step.
		/// </param>
		/// <remarks>
		/// The method must add/remove/update the DTOs to the repository,
		/// as it adds/removes objects as part of its work.
		///
		/// Implementors of this interface should ensure the Repository's
		/// starting model version number is correct for the step.
		/// Implementors must also increment the Repository's model version number
		/// at the end of its migration work.
		///
		/// The method also should normally modify the xml string(s)
		/// of relevant DTOs, since that string will be used by the main
		/// data migration calling client (ie. BEP).
		/// </remarks>
		/// ------------------------------------------------------------------------------------
		public void PerformMigration(IDomainObjectDTORepository domainObjectDtoRepository)
		{
			DataMigrationServices.CheckVersionNumber(domainObjectDtoRepository, 7000004);

			// 1. Change EventTypes field to RecTypes
			var nbkDto = domainObjectDtoRepository.AllInstancesSansSubclasses("RnResearchNbk").First();
			var nbkElement = XElement.Parse(nbkDto.Xml);
			var nbkClsElement = nbkElement.Element("RnResearchNbk");
			var typesFieldElement = nbkClsElement.Element("EventTypes");
			var typesSurElement = typesFieldElement.Element("objsur");
			nbkClsElement.Add(new XElement("RecTypes", typesSurElement));
			typesFieldElement.Remove();
			DataMigrationServices.UpdateDTO(domainObjectDtoRepository, nbkDto, nbkElement.ToString());

			// 2. Add Analysis possibility to Record Types list
			var typesGuid = typesSurElement.Attribute("guid").Value;
			var typesDto = domainObjectDtoRepository.GetDTO(typesGuid);
			var typesElement = XElement.Parse(typesDto.Xml);
			typesElement.XPathSelectElement("CmMajorObject/Name/AUni[@ws='en']").SetValue("Entry Types");
			var posElement = typesElement.XPathSelectElement("CmPossibilityList/Possibilities");
			posElement.Add(
				DataMigrationServices.CreateOwningObjSurElement("82290763-1633-4998-8317-0EC3F5027FBD"));
			DataMigrationServices.UpdateDTO(domainObjectDtoRepository, typesDto,
				typesElement.ToString());
			var ord = posElement.Elements().Count();

			var nowStr = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");
			var typeElement = new XElement("rt", new XAttribute("class", "CmPossibility"),
				new XAttribute("guid", "82290763-1633-4998-8317-0EC3F5027FBD"),
				new XAttribute("ownerguid", typesGuid),
				new XAttribute("owningflid", "8008"), new XAttribute("owningord", ord.ToString()),
				new XElement("CmObject"),
				new XElement("CmPossibility",
					new XElement("Abbreviation",
						new XElement("AUni", new XAttribute("ws", "en"), "Ana")),
					new XElement("BackColor", new XAttribute("val", "16711680")),
					new XElement("DateCreated", new XAttribute("val", nowStr)),
					new XElement("DateModified", new XAttribute("val", nowStr)),
					new XElement("Description",
						new XElement("AStr", new XAttribute("ws", "en"),
							new XElement("Run", new XAttribute("ws", "en"), "Reflection on events and other types of data, such as literature summaries or interviews. An analysis does not add data; it interprets and organizes data. An analysis entry may synthesize emerging themes. It may draw connections between observations. It is a place to speculate and hypothesize, or document moments of discovery and awareness. Analytic notes can be turned into articles. Or, they may just be steps on the stairway toward greater understanding."))),
					new XElement("ForeColor", new XAttribute("val", "16777215")),
					new XElement("Name",
						new XElement("AUni", new XAttribute("ws", "en"), "Analysis")),
					new XElement("UnderColor", new XAttribute("val", "255")),
					new XElement("UnderStyle", new XAttribute("val", "1"))));
			domainObjectDtoRepository.Add(new DomainObjectDTO("82290763-1633-4998-8317-0EC3F5027FBD",
				"CmPossibility", typeElement.ToString()));

			// 3. Move the attributes that are in RnEvent and RnAnalysis into RnGenericRec.
			MigrateSubclassOfGenRec(domainObjectDtoRepository, "RnEvent");
			MigrateSubclassOfGenRec(domainObjectDtoRepository, "RnAnalysis");

			DataMigrationServices.IncrementVersionNumber(domainObjectDtoRepository);
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:77,代码来源:DataMigration7000005.cs



注:本文中的IDomainObjectDTORepository类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IDotNetProject类代码示例发布时间:2022-05-24
下一篇:
C# IDomObject类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap