当前位置: 首页>>代码示例>>C#>>正文


C# IDomainObjectDTORepository.AllInstancesWithSubclasses方法代码示例

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


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

示例1: 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

示例2: 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

示例3: PerformMigration

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Add DateModified to StText
		/// </summary>
		/// <param name="domainObjectDtoRepository">
		/// Repository of all CmObject DTOs available for one migration step.
		/// </param>
		/// ------------------------------------------------------------------------------------
		public void PerformMigration(IDomainObjectDTORepository domainObjectDtoRepository)
		{
			DataMigrationServices.CheckVersionNumber(domainObjectDtoRepository, 7000035);

			foreach (var stTextDTO in domainObjectDtoRepository.AllInstancesWithSubclasses("StText"))
			{
				XElement stText = XElement.Parse(stTextDTO.Xml);
				if (stText.Element("DateModified") != null)
					continue; // Already has a DateModified property (probably an StJounalText

				XElement dateModified = new XElement("DateModified", null);
				XAttribute value = new XAttribute("val", ReadWriteServices.FormatDateTime(DateTime.Now));
				dateModified.Add(value);
				stText.Add(dateModified);
				DataMigrationServices.UpdateDTO(domainObjectDtoRepository, stTextDTO, stText.ToString());
			}

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

示例4: ConvertAllRefsToStrings

		private static void ConvertAllRefsToStrings(IDomainObjectDTORepository domainObjectDtoRepository, string className,
			Dictionary<string, Tuple<string, DomainObjectDTO, XElement>> guidToWsInfo, HashSet<string> referencedWsIds)
		{
			foreach (DomainObjectDTO dto in domainObjectDtoRepository.AllInstancesWithSubclasses(className))
			{
				XElement elem = XElement.Parse(dto.Xml);
				if (ConvertRefToString(elem.Element("WritingSystem"), guidToWsInfo, referencedWsIds))
					DataMigrationServices.UpdateDTO(domainObjectDtoRepository, dto, elem.ToString());
			}
		}
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:10,代码来源:DataMigration7000019.cs

示例5: ConvertAllIcuLocalesToLangTags

		private static void ConvertAllIcuLocalesToLangTags(IDomainObjectDTORepository domainObjectDtoRepository, string className,
			HashSet<string> referencedWsIds)
		{
			foreach (DomainObjectDTO dto in domainObjectDtoRepository.AllInstancesWithSubclasses(className))
			{
				XElement elem = XElement.Parse(dto.Xml);
				XElement icuLocaleElem = elem.Element("ICULocale");
				if (icuLocaleElem != null)
				{
					string wsId = Version19LangTagUtils.ToLangTag((string) icuLocaleElem.Element("Uni"));
					icuLocaleElem.AddAfterSelf(new XElement("WritingSystem",
						new XElement("Uni", wsId)));
					icuLocaleElem.Remove();
					DataMigrationServices.UpdateDTO(domainObjectDtoRepository, dto, elem.ToString());
					referencedWsIds.Add(wsId);
				}
			}
		}
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:18,代码来源:DataMigration7000019.cs

示例6: VerifyNoDirectFormatting

		private void VerifyNoDirectFormatting(IDomainObjectDTORepository repoDTO)
		{
			byte[] rgbRun = Encoding.UTF8.GetBytes("<Run ");
			foreach (DomainObjectDTO dto in repoDTO.AllInstancesWithValidClasses())
			{
				if (dto.XmlBytes.IndexOfSubArray(rgbRun) <= 0)
					continue;
				XElement xeObj = XElement.Parse(dto.Xml);
				foreach (XElement xe in xeObj.Descendants("Run"))
				{
					foreach (XAttribute xa in xe.Attributes())
					{
						Assert.IsTrue(xa.Name.LocalName == "ws" ||
							xa.Name.LocalName == "namedStyle" ||
							xa.Name.LocalName == "externalLink",
							"only ws, namedStyle, and externalLink should exist as Run attributes in the test data");
					}
				}
			}
			byte[] rgbStyleRules = Encoding.UTF8.GetBytes("<StyleRules>");
			foreach (DomainObjectDTO dto in repoDTO.AllInstancesWithSubclasses("StTxtPara"))
			{
				if (dto.XmlBytes.IndexOfSubArray(rgbStyleRules) <= 0)
					continue;
				XElement xeObj = XElement.Parse(dto.Xml);
				foreach (XElement xe in xeObj.Descendants("Prop"))
				{
					foreach (XAttribute xa in xe.Attributes())
					{
						Assert.AreEqual("namedStyle", xa.Name.LocalName,
							"Direct formatting of paragraphs should not exist (" + xa.Name + ")");
					}
				}
			}
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:35,代码来源:DataMigration7000018Tests.cs

示例7: GetAllExternalLinksInTsStrings

		private List<String> GetAllExternalLinksInTsStrings(IDomainObjectDTORepository dtoRepos)
		{
			var filesPathsInTsStrings = new List<String>();
			foreach (var dto in dtoRepos.AllInstancesWithSubclasses("CmObject"))  //Get the Elements for all CmObjects
			{
				if (!dto.Xml.Contains("externalLink"))
					continue;
				//byte[] matchString = Encoding.UTF8.GetBytes("externalLink");
				//if (!dto.XmlBytes.Contains(matchString))
				//    continue;
				var dtoXML = XElement.Parse(dto.Xml);
				foreach (var runXMLElement in dtoXML.XPathSelectElements("//Run"))
				{
					var externalLinkAttributeForThisRun = runXMLElement.Attribute("externalLink");
					if (externalLinkAttributeForThisRun != null)
					{
						filesPathsInTsStrings.Add(externalLinkAttributeForThisRun.Value);
						//Check the path and if it is a rooted path which is relative to the LinkedFilesRootDir
						//then we will have to confirm that is was changed to a relative path after the migration.
					}
				}
			}
			return filesPathsInTsStrings;
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:24,代码来源:DataMigration7000030Tests.cs

示例8: FixOwnershipOfSubtypes

		private void FixOwnershipOfSubtypes(IDomainObjectDTORepository repoDto)
		{
			var types = repoDto.AllInstancesWithSubclasses("LexEntryType");
			var cFixedFirst = 0;
			foreach (var dto in types)
			{
				var xml = dto.Xml;
				var fFixed = false;
				foreach (var badGuid in m_mapBadGoodGuids.Keys)
				{
					if (xml.Contains(badGuid))
					{
						var bad = String.Format("guid=\"{0}\"", badGuid);
						var good = String.Format("guid=\"{0}\"", m_mapBadGoodGuids[badGuid]);
						xml = xml.Replace(bad, good);
						var bad2 = String.Format("guid='{0}'", badGuid);
						var good2 = String.Format("guid='{0}'", m_mapBadGoodGuids[badGuid]);
						xml = xml.Replace(bad2, good2);	// probably pure paranoia...
						fFixed = true;
					}
				}
				if (fFixed)
				{
					dto.Xml = xml;
					repoDto.Update(dto);
					++cFixedFirst;
				}
				var cFixed = 0;
				foreach (var dtoSub in repoDto.GetDirectlyOwnedDTOs(dto.Guid))
				{
					DomainObjectDTO dtoOwner;
					if (!repoDto.TryGetOwner(dtoSub.Guid, out dtoOwner) || dtoOwner != dto)
					{
						// we have a broken ownership link -- fix it!
						var xeSub = XElement.Parse(dtoSub.Xml);
						var xaOwner = xeSub.Attribute("ownerguid");
						if (xaOwner == null)
							xeSub.Add(new XAttribute("ownerguid", dto.Guid));
						else
							xaOwner.Value = dto.Guid;
						dtoSub.Xml = xeSub.ToString();
						repoDto.Update(dtoSub);
						++cFixed;
					}
				}
			}
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:47,代码来源:DataMigration7000042.cs

示例9: ChangeInvalidGuid

		private void ChangeInvalidGuid(IDomainObjectDTORepository repoDto, LexTypeInfo info,
			string name, string guidStd)
		{
			var xaGuid = info.XmlElement.Attribute("guid");
			if (xaGuid == null)
				throw new Exception("The object does not have a guid -- this is impossible!");
			xaGuid.SetValue(guidStd);
			var guidBad = info.DTO.Guid;
			if (!m_mapBadGoodGuids.ContainsKey(guidBad))
				m_mapBadGoodGuids.Add(guidBad, guidStd);
			var className = info.DTO.Classname;
			repoDto.Remove(info.DTO);
			info.DTO = new DomainObjectDTO(guidStd, className, info.XmlElement.ToString());
			repoDto.Add(info.DTO);
			// Fix the owning reference (but only if it's one of the two lists, because otherwise
			// it might be contained in a LexTypeInfo that hasn't yet been processed).
			var bad = String.Format("guid=\"{0}\"", guidBad);
			var good = String.Format("guid=\"{0}\"", guidStd);
			var bad2 = String.Format("guid='{0}'", guidBad);	// probably pure paranoia...
			var good2 = String.Format("guid='{0}'", guidStd);
			DomainObjectDTO dtoOwner;
			if (repoDto.TryGetOwner(info.DTO.Guid, out dtoOwner) && dtoOwner.Classname == "CmPossibilityList")
			{
				dtoOwner.Xml = dtoOwner.Xml.Replace(bad, good).Replace(bad2, good2);
				repoDto.Update(dtoOwner);
			}
			// Fix any references from LexEntryRef objects.
			foreach (var dtoRef in repoDto.AllInstancesWithSubclasses("LexEntryRef"))
			{
				var xml = dtoRef.Xml;
				if (xml.Contains(guidBad))
				{
					dtoRef.Xml = xml.Replace(bad, good).Replace(bad2, good2);
					repoDto.Update(dtoRef);
				}
			}
			m_mapNameGuid.Remove(name);
			m_mapGuidName.Remove(guidStd);
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:39,代码来源:DataMigration7000042.cs

示例10: GetDtoLangProj

		private DomainObjectDTO GetDtoLangProj(IDomainObjectDTORepository repoDTO)
		{
			DomainObjectDTO dtoLP = null;
			foreach (var dto in repoDTO.AllInstancesWithSubclasses("LangProject"))
			{
				dtoLP = dto;
				break;
			}
			return dtoLP;
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:10,代码来源:DataMigration7000017.cs

示例11: IsWeatherUsed

		private bool IsWeatherUsed(IDomainObjectDTORepository repoDTO, List<DomainObjectDTO> collectOverlaysToRemove)
		{
			DomainObjectDTO dtoLP = GetDtoLangProj(repoDTO);
			string sLpXml = dtoLP.Xml;
			int idxW = sLpXml.IndexOf("<WeatherConditions>");
			var sguidWeather = ExtractFirstGuid(sLpXml, idxW, " guid=\"");
			DomainObjectDTO dtoWeather = repoDTO.GetDTO(sguidWeather);
			var weatherItems = new HashSet<string>();
			CollectItems(repoDTO, dtoWeather, weatherItems);
			foreach (var dto in repoDTO.AllInstancesWithSubclasses("RnGenericRec"))
			{
				string sXml = dto.Xml;
				int idx = sXml.IndexOf("<Weather>");
				if (idx > 0)
				{
					int idxEnd = sXml.IndexOf("</Weather>");
					if (idxEnd > idx)
					{
						string s = sXml.Substring(idx, idxEnd - idx);
						if (s.Contains("<objsur "))
						{
							return true;
						}
					}
				}
				bool dummy = false;
				if (StringContainsRefToItemInList("PhraseTags", weatherItems, sXml, ref dummy)) return true;
			}
			foreach (var dto in repoDTO.AllInstancesSansSubclasses("CmOverlay"))
			{
				string sXml = dto.Xml;
				bool hasOtherItems = false;
				bool hasWeatherRef = StringContainsRefToItemInList("PossItems", weatherItems, sXml, ref hasOtherItems);
				var weatherListSet = new HashSet<string>();
				weatherListSet.Add(sguidWeather.ToLowerInvariant());
				hasWeatherRef |= StringContainsRefToItemInList("PossList", weatherListSet, sXml, ref hasOtherItems);
				if (hasWeatherRef)
				{
					if (hasOtherItems)
						return true; // an overlay with a mixture of weather and non-weather items is a problem
					// One with only weather refs (and not used, since we know nothing is tagged to weather)
					// will be deleted.
					collectOverlaysToRemove.Add(dto);
				}
			}
			return false;
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:47,代码来源:DataMigration7000017.cs

示例12: ConvertWeatherToCustomListAndField

		/// <summary>
		/// The weather list is used, so convert it to a custom (unowned) list, create a new
		/// custom field for RnGenericRec elements, and convert any Weather elements to that
		/// new custom field.
		/// </summary>
		private void ConvertWeatherToCustomListAndField(IDomainObjectDTORepository repoDTO)
		{
			// Change the Weather list to being unowned.
			DomainObjectDTO dtoLP = null;
			foreach (var dto in repoDTO.AllInstancesWithSubclasses("LangProject"))
			{
				dtoLP = dto;
				break;
			}
			string sWeatherListGuid = RemoveWeatherConditionsElement(dtoLP).ToLowerInvariant();
			repoDTO.Update(dtoLP);
			DomainObjectDTO dtoWeatherList = null;
			foreach (var dto in repoDTO.AllInstancesWithSubclasses("CmPossibilityList"))
			{
				if (dto.Guid.ToLowerInvariant() == sWeatherListGuid)
				{
					dtoWeatherList = dto;
					break;
				}
			}
			dtoWeatherList.Xml = RemoveOwnerGuid(dtoWeatherList.Xml);
			repoDTO.Update(dtoWeatherList);

			// Create the custom field.
			string fieldName = "Weather";
			while (repoDTO.IsFieldNameUsed("RnGenericRec", fieldName))
				fieldName = fieldName + "A";
			repoDTO.CreateCustomField("RnGenericRec", fieldName, SIL.CoreImpl.CellarPropertyType.ReferenceCollection,
				CmPossibilityTags.kClassId, "originally a standard part of Data Notebook records",
				WritingSystemServices.kwsAnals, new Guid(sWeatherListGuid));

			string customStart = String.Format("<Custom name=\"{0}\">", fieldName);

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

示例13: ProcessParagraphs

		private static void ProcessParagraphs(
			IDomainObjectDTORepository dtoRepos,
			IDictionary<string, byte[]> oldCCAs,
			IEnumerable<KeyValuePair<byte[], XElement>> halfBakedCcwgItems,
			IDictionary<string, SortedList<int, byte[]>> paraToOldSegments,
			IDictionary<string, SortedList<int, byte[]>> paraToOldXfics,
			IDictionary<Guid, Guid> ccaGuidMap,
			ICollection<byte[]> oldTextTags,
			Dictionary<string, List<byte[]>> freeTrans,
			Dictionary<string, List<byte[]>> litTrans,
			Dictionary<string, List<byte[]>> notes)
		{
			var dtos = dtoRepos.AllInstancesWithSubclasses("StTxtPara");
			//var count = dtos.Count();
			//var num = 0;
			//var cpara = 0;
			foreach (var currentParaDto in dtos)
			{
				//++num;
				// If it has no contents, then skip it.
				var stTxtParaBounds = new ElementBounds(currentParaDto.XmlBytes, s_tagsStTxtPara);
				if (!stTxtParaBounds.IsValid)
					continue;
				var contentsBounds = new ElementBounds(currentParaDto.XmlBytes, s_tagsContents,
					stTxtParaBounds.BeginTagOffset, stTxtParaBounds.EndTagOffset);
				if (!contentsBounds.IsValid)
					continue;
				//++cpara;

				// Mark the paragraph as needing retokenization.
				MarkParaAsNeedingTokenization(dtoRepos, currentParaDto);

				var currentParaGuid = currentParaDto.Guid.ToLower();
				SortedList<int, byte[]> xficsForCurrentPara;
				paraToOldXfics.TryGetValue(currentParaGuid, out xficsForCurrentPara);

				SortedList<int, byte[]> segsForCurrentPara;
				if (!paraToOldSegments.TryGetValue(currentParaGuid, out segsForCurrentPara)
					&& xficsForCurrentPara != null
					&& xficsForCurrentPara.Count > 0)
				{
					// We have no segments at all, but there are xfics, so try to recover the broken data,
					// as much as possible.
					// Need to create a new old segment XElement (not dto), to try and and keep old data.
					var guidBrandNewSeg = Guid.NewGuid();
					var brandNewSegGuid = guidBrandNewSeg.ToString().ToLower();
					ccaGuidMap.Add(guidBrandNewSeg, guidBrandNewSeg);
					segsForCurrentPara = new SortedList<int, byte[]>();
					paraToOldSegments.Add(currentParaGuid, segsForCurrentPara);
					var bldr = new StringBuilder();
					bldr.AppendFormat("<rt guid=\"{0}\"", brandNewSegGuid);
					bldr.Append("<CmObject/>");
					bldr.Append("<CmBaseAnnotation>");
					bldr.Append("<BeginOffset val=\"0\"/>");
					bldr.AppendFormat("<EndOffset val=\"{0}\"/>", int.MaxValue);
					bldr.Append("</CmBaseAnnotation>");
					bldr.Append("</rt>");
					segsForCurrentPara.Add(0, Encoding.UTF8.GetBytes(bldr.ToString()));
				}

				// If the para has no segs or xfics, skip the following work.
				if (segsForCurrentPara == null)
					continue;

				if (xficsForCurrentPara != null && xficsForCurrentPara.Count > 0 && segsForCurrentPara.Count > 0)
				{
					// We have both segments and xfics. Check for odd case (like FWR-3081)
					// where the first segment starts AFTER the first xfic, and add a new
					// segment that covers the text up to the first current segment.
					if (xficsForCurrentPara.First().Key < segsForCurrentPara.First().Key)
						AddExtraInitialSegment(currentParaGuid, ccaGuidMap, paraToOldSegments);
				}
				var halfBakedCcwgItemsForCurrentPara = new List<KeyValuePair<byte[], XElement>>();
				List<string> writingSystems;
				var runs = GetParagraphContentRuns(currentParaDto.XmlBytes, out writingSystems);
				// We may well have segments with no xfics, for example, Scripture that has segmented BT.
				if (xficsForCurrentPara != null)
				{

					// Since pfics/wfics were 'optional' and usually not maintained in the db,
					// we need to make sure there is a dummy one in xficsForCurrentPara
					// in order to get the correct Begin/EndAnalysisIndex for chart and tagging objects
					// It turns out we don't need to worry about ws and exact begin/end character offsets.
					// All we need to end up with correct indices is the correct NUMBER of xfics.
					var context = new ParagraphContext(currentParaGuid, xficsForCurrentPara);
					EnsureAllXfics(runs, context);

					// Find any 'halfbaked' items for the current paragraph.
					// Get the para for the first objsur's guid (some twfic ann),
					// in the CmIndirectAnnotation's AppliesTo prop.
					foreach (var kvp in halfBakedCcwgItems)
					{
						var refs = GetAppliesToObjsurGuids(kvp.Key);
						if (refs == null || refs.Count == 0)
							continue;
						var guid = refs[0];
						var dto = dtoRepos.GetDTO(guid);
						var guidBegin = GetBeginObjectGuid(dto.XmlBytes);
						if (guidBegin == currentParaGuid)
							halfBakedCcwgItemsForCurrentPara.Add(kvp);
//.........这里部分代码省略.........
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:101,代码来源:DataMigration7000010.cs

示例14: VerifyEntryTypeOwners

		/// <summary>
		/// Verify that every LexEntryType points back to a valid owner after migration, and that
		/// the owner points to the LexEntryType.
		/// </summary>
		/// <param name="repoDto"></param>
		private static void VerifyEntryTypeOwners(IDomainObjectDTORepository repoDto)
		{
			foreach (var dto in repoDto.AllInstancesWithSubclasses("LexEntryType"))
			{
				DomainObjectDTO dtoOwner;
				Assert.IsTrue(repoDto.TryGetOwner(dto.Guid, out dtoOwner), "All entry types should have valid owners!");
				DomainObjectDTO dtoOwnedOk = null;
				foreach (var dtoT in repoDto.GetDirectlyOwnedDTOs(dtoOwner.Guid))
				{
					if (dtoT == dto)
					{
						dtoOwnedOk = dtoT;
						break;
					}
				}
				Assert.AreEqual(dto, dtoOwnedOk, "The owner should own the entry type!");
			}
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:23,代码来源:DataMigration7000042Tests.cs

示例15: VerifyLexEntryRefs

		/// <summary>
		/// Verify that all LexEntryRef objects point to valid LexEntryType objects.
		/// </summary>
		private void VerifyLexEntryRefs(IDomainObjectDTORepository repoDto)
		{
			foreach (var dtoRef in repoDto.AllInstancesWithSubclasses("LexEntryRef"))
			{
				var xeRef = XElement.Parse(dtoRef.Xml);
				foreach (var objsur in xeRef.XPathSelectElements("ComplexEntryTypes/objsur"))
				{
					var xaGuid = objsur.Attribute("guid");
					Assert.IsNotNull(xaGuid, "objsur elements should always have a guid attribute.");
					var guid = xaGuid.Value;
					DomainObjectDTO dtoType;
					Assert.IsTrue(repoDto.TryGetValue(guid, out dtoType), "LexEntryRef.ComplexEntryTypes should point to valid objects.");
				}
				foreach (var objsur in xeRef.XPathSelectElements("VariantEntryTypes/objsur"))
				{
					var xaGuid = objsur.Attribute("guid");
					Assert.IsNotNull(xaGuid, "objsur elements should always have a guid attribute.");
					var guid = xaGuid.Value;
					DomainObjectDTO dtoType;
					Assert.IsTrue(repoDto.TryGetValue(guid, out dtoType), "LexEntryRef.VariantEntryTypes should point to valid objects.");
				}
			}
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:26,代码来源:DataMigration7000042Tests.cs


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