SourceVersionComparisonType Enumeration

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

Summary

Specifies which stored versions of a source object an incoming source definition is compared with when Context.SyncSources(..) checks it.

Syntax

public enum SourceVersionComparisonType
{
	// Compares with the most recently stored version only. The default
	CompareToLastVersion = 0,

	// Compares with the version that is in production only
	CompareToProductionVersion = 1,

	// Compares with every stored version, newest first, and stops at the first match
	CompareToAllVersions = 2
}

Remarks

Set the value through SourceSettings.ComparisonType, which defaults to CompareToLastVersion. It applies to every definition of the call. A definition that matches the version it is compared with writes nothing, or only updates the labels of that version (see SourceOutcome). A definition that matches no version it is compared with creates a new version.

The members differ in when they create a version that already existed earlier:

  • CompareToLastVersion compares with the most recently stored version only. A definition that matches an older version but not the latest one, as after a rolled-back deployment, is stored as a new version, so identical versions can occur.
  • CompareToProductionVersion compares with the version that is currently in production. A source object that has no production version yet is compared with its most recently stored version instead.
  • CompareToAllVersions compares with every stored version, newest first, and stops at the first match. It creates a version only when no stored version matches, so it never stores the same definition twice. It reads more of the repository than the other two.

The version the definition was compared with is reported by SourceResult.ComparedVersionId.

Example

using CodeEffects.Rule.Repository;
using CodeEffects.Rule.Repository.Common;

var settings = new SourceSettings
{
	ComparisonType = SourceVersionComparisonType.CompareToAllVersions
};

settings.SourceTypes.Add(typeof(Order));

Context.SyncSources(dbProvider, settings);

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

p102

l097 --

l102

p101

×