本文整理汇总了C#中IDomainObjectDTORepository.AllInstancesWithValidClasses方法的典型用法代码示例。如果您正苦于以下问题:C# IDomainObjectDTORepository.AllInstancesWithValidClasses方法的具体用法?C# IDomainObjectDTORepository.AllInstancesWithValidClasses怎么用?C# IDomainObjectDTORepository.AllInstancesWithValidClasses使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDomainObjectDTORepository
的用法示例。
在下文中一共展示了IDomainObjectDTORepository.AllInstancesWithValidClasses方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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);
}
示例2: PerformMigration
/// ------------------------------------------------------------------------------------
/// <summary>
/// Change all guids to lowercase to help the Chorus diff/merge code.
/// </summary>
/// ------------------------------------------------------------------------------------
public void PerformMigration(IDomainObjectDTORepository domainObjectDtoRepository)
{
DataMigrationServices.CheckVersionNumber(domainObjectDtoRepository, 7000022);
foreach (var dto in domainObjectDtoRepository.AllInstancesWithValidClasses())
{
var rtElement = XElement.Parse(dto.Xml);
if (ShiftCase(rtElement))
DataMigrationServices.UpdateDTO(domainObjectDtoRepository, dto, rtElement.ToString());
}
DataMigrationServices.IncrementVersionNumber(domainObjectDtoRepository);
}
示例3: PerformMigration
public void PerformMigration(IDomainObjectDTORepository domainObjectDtoRepository)
{
DataMigrationServices.CheckVersionNumber(domainObjectDtoRepository, 7000036);
string path = domainObjectDtoRepository.ProjectFolder;
string project = Path.GetFileName(path);
foreach (var dto in domainObjectDtoRepository.AllInstancesWithValidClasses())
{
if (dto.XmlBytes.IndexOfSubArray(s_externalLinkTag) < 0)
continue;
XElement xel = XElement.Parse(dto.Xml);
if (FixExternalLinks(xel, project))
DataMigrationServices.UpdateDTO(domainObjectDtoRepository, dto, xel.ToString());
}
DataMigrationServices.IncrementVersionNumber(domainObjectDtoRepository);
}
示例4: CollectionNonSilfwLinks
private void CollectionNonSilfwLinks(IDomainObjectDTORepository dtoRepos)
{
foreach (var dto in dtoRepos.AllInstancesWithValidClasses())
{
string xml = dto.Xml;
Assert.IsTrue(xml.Contains("externalLink"), "Every object in the test has an externalLink");
var dtoXML = XElement.Parse(xml);
foreach (var run in dtoXML.XPathSelectElements("//Run"))
{
var externalLinkAttr = run.Attribute("externalLink");
if (externalLinkAttr != null)
{
string value = externalLinkAttr.Value;
if (value.StartsWith("http://") || value.StartsWith("libronixdls:"))
m_rgsOtherLinks.Add(value);
++m_cLinks;
}
}
}
}
示例5: Delint
/// <summary>
/// 1. Remove objects (zombies) that:
/// A. claim to have owners, but the owners do not exist, or
/// B. owners don't know they own it, or
/// C. objects with no owners that are not supported as allowing no owners.
/// 2. Remove 'dangling' references to objects that no longer exist.
/// 3. Remove properties that have no attributes or content.
/// </summary>
internal static void Delint(IDomainObjectDTORepository dtoRepos)
{
// Remove zombies.
// By removing zombies first, any references to them will be 'dangling',
// so can be removed in the following step.
var allInstancesWithValidClasses = dtoRepos.AllInstancesWithValidClasses().ToList();
RemoveZombies(dtoRepos, allInstancesWithValidClasses);
// Ask again, since zombies will have been removed.
allInstancesWithValidClasses = dtoRepos.AllInstancesWithValidClasses().ToList();
RemoveDanglingReferences(dtoRepos, allInstancesWithValidClasses);
// Get rid of all property elements that are empty,
// since the xml loader code isn't happy with certain empty elements.
RemoveEmptyPropertyElements(dtoRepos, allInstancesWithValidClasses);
}
示例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 + ")");
}
}
}
}
示例7: ProcessExternalLinksRelativePaths
private List<string> ProcessExternalLinksRelativePaths(IDomainObjectDTORepository dtoRepos, String linkedFilesRootDir)
{
var filePathsInTsStrings = new List<string>();
foreach (var dto in dtoRepos.AllInstancesWithValidClasses()) //Get the Elements for all CmObjects
{
if (dto.XmlBytes.IndexOfSubArray(externalLinkTag) < 0)
continue;
var dtoXML = XElement.Parse(dto.Xml);
foreach (var runXMLElement in dtoXML.XPathSelectElements("//Run"))
{
var externalLinkAttributeForThisRun = runXMLElement.Attribute("externalLink");
if (externalLinkAttributeForThisRun != null)
{
try
{
//Convert the file paths which should be stored as relative paths
if (Path.IsPathRooted(FileUtils.ChangeWindowsPathIfLinux(externalLinkAttributeForThisRun.Value)))
{
var filePath = FileUtils.ChangeWindowsPathIfLinux(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.
var fileAsRelativePath = LinkedFilesRelativePathHelper.GetRelativeLinkedFilesPath(filePath,
linkedFilesRootDir);
//Save the file paths so they can be turned into CmFiles
filePathsInTsStrings.Add(fileAsRelativePath);
//If these two strings do not match then a full path was converted to a LinkedFiles relative path
//so replace the path in the CmFile object.
if (!String.Equals(fileAsRelativePath, filePath))
{
runXMLElement.Attribute("externalLink").Value = fileAsRelativePath;
UpdateDto(dtoRepos, dto, dtoXML);
}
}
else
{
//if the file path was already relative we want to save it and turn it into a CmFiles
if (FileUtils.IsFileUriOrPath(externalLinkAttributeForThisRun.Value) && FileUtils.IsFilePathValid(externalLinkAttributeForThisRun.Value))
filePathsInTsStrings.Add(externalLinkAttributeForThisRun.Value);
}
}
catch (ArgumentException)
{
Logger.WriteEvent("Invalid path for external link - no CmFile created: " + externalLinkAttributeForThisRun);
}
}
}
}
return filePathsInTsStrings;
}