SourceResult Class

Assembly: CodeEffects.Rule.Repository.dll
Namespace: CodeEffects.Rule.Repository

Summary

Describes what Context.SyncSources(..) did with one source definition: the outcome, the IDs of the records it touched, and the reason when it failed.

Syntax

public class SourceResult

Remarks

You never create this class. SyncResult.Sources holds one SourceResult for each definition you supplied in SourceSettings. When any definition fails, Context.SyncSources(..) still processes all the others and then throws a RepositoryException that carries the complete SyncResult, so you can log which definitions failed and why.

All properties are read-only. Check Outcome first; the other properties say more about it. A definition that fails writes nothing.

Properties

  • AliasName

    Type: System.String

    Gets the alias of the definition's main source object, or null when the definition could not be read far enough to find it.

  • ComparedVersionId

    Type: System.Nullable<System.Int32>

    Gets the ID of the stored version that the definition was compared with, or null for a new source.

  • ControlNumber

    Type: System.String

    Gets the Code Effects control number of the failure, or null when the definition did not fail or failed for a reason outside Code Effects code, such as a database error. Quote it when you contact Code Effects support.

  • DifferenceCount

    Type: System.Int32

    Gets the number of differences that made this a new version. It is zero unless Outcome is VersionCreated.

  • Error

    Type: System.Exception

    Gets the exception that made the definition fail, or null. It is meant for your log.

  • Index

    Type: System.Int32

    Gets the zero-based position of the definition in its own list: SourceXmls for SourceKind.Xml, SourceTypes for SourceKind.Type, and SourceProviders for SourceKind.Provider. Kind says which list it counts in.

  • Kind

    Type: CodeEffects.Rule.Repository.Common.SourceKind

    Gets the form that the definition was given in: a Source XML document, a type, or an Adaptive Source provider.

  • LabelChangeCount

    Type: System.Int32

    Gets the number of display name and description changes found. When Outcome is LabelsUpdated, these were written to the stored version.

  • Message

    Type: System.String

    Gets a short description of what was done, or why it failed.

  • Outcome

    Type: CodeEffects.Rule.Repository.Common.SourceOutcome

    Gets what was done: Unchanged, LabelsUpdated, SourceCreated, VersionCreated, or Failed.

  • SourceRecordId

    Type: System.Nullable<System.Int32>

    Gets the ID of the source record, or null when the definition failed before one was found or created.

  • SourceVersionId

    Type: System.Nullable<System.Int32>

    Gets the ID of the source version that was created, updated, or matched, or null when the definition failed.

  • TestCount

    Type: System.Int32

    Gets the number of tests copied or moved to the new version. See TestsHandling of SourceSettings.

  • TestsSourceVersionId

    Type: System.Nullable<System.Int32>

    Gets the ID of the version that tests were copied or moved from, or null when none were.

  • UsersToNotify

    Type: System.Collections.Generic.IList<System.String>

    Gets the IDs of the users who would want to know about the change: every known user for a new source, and every creator, modifier, and last runner of a test of the source for a new version. The list is empty in all other cases. The sync does not raise a notification for them itself; the list is for your own use.

    Example

      using System;
      using System.Collections.Generic;
      using System.Linq;
      using CodeEffects.Rule.Repository;
      using CodeEffects.Rule.Repository.Common;
    
      SyncResult result = Context.SyncSources(dbProvider, new SourceSettings { SourceTypes = new List<Type> { typeof(Order) } });
    
      foreach(SourceResult source in result.Sources.Where(s => s.Outcome == SourceOutcome.VersionCreated))
      	Console.WriteLine(source.AliasName + ": version " + source.SourceVersionId + " differs from version " + source.ComparedVersionId + " in " + source.DifferenceCount + " place(s)");
    

Ask on Stack Overflow - Yes, it's still active
Ask in GitHub Discussions

p102

l097 --

l102

p101

×