SyncResult Class
Assembly: CodeEffects.Rule.Repository.dll
Namespace: CodeEffects.Rule.Repository
Summary
Describes what Context.SyncSources(..) did: one SourceResult per supplied definition, and two repository-wide warnings.
Syntax
public class SyncResult
You never create this class. Context.SyncSources(..) returns it. If any definition fails, the method throws a RepositoryException after it has processed all the others, and the exception's SyncResult property holds the same object, so a failed sync is inspected the same way as a successful one.
AliasesToReindex and SourcesOutOfSync are warnings. They look at the whole repository, not only at the definitions you supplied, and they are filled in even when the sync throws.
Properties
AliasesToReindex
Type: System.Collections.Generic.IList<System.String>
Gets the alias of every source object in the repository whose member usage index was never built, or was built by an earlier release that computed it differently. It covers every such source object, not only those you supplied. It is empty when the whole repository is current.
This is a warning, not a failure. Rules on these sources evaluate as they always did, but what the index answers about them is incomplete until they are reindexed: which rules use a member, what a new source version would break, and which members nothing uses. A repository that was upgraded to a release with the index lists every source object it already held.
Context.SyncSources(..) never reindexes by itself. Pass this list to Context.Reindex(..) when it suits your application. Do it after the sync, not alongside it: a sync and a reindex of the same source object can deadlock (both retry once).
Sources
Type: System.Collections.Generic.IList<CodeEffects.Rule.Repository.SourceResult>
Gets one entry per supplied source: those in SourceXmls in the order they were supplied, then those in SourceTypes, then those in SourceProviders. Kind of each entry says which list it came from.
SourcesOutOfSync
Type: System.Collections.Generic.IList<CodeEffects.Rule.Repository.EmbeddedSourceMismatch>
Gets every source object whose latest definition embeds a type that is also a source object of its own, where the two declare different members. It covers the whole repository, not only the definitions that this call was given. It is empty when every pair agrees.
This is a warning, not a failure. See EmbeddedSourceMismatch. It arises when you sync one of the two and not the other, or define them from different inputs. Syncing both again from the same definitions clears it.
Only pairs whose source objects are both indexed at the current index version are compared. The others are listed in AliasesToReindex and are compared once they have been reindexed.
Success
Type: System.Boolean
Gets a value indicating whether every supplied source definition was processed, that is, none of the entries in Sources has the outcome Failed.
Example
using System;
using System.Collections.Generic;
using CodeEffects.Rule.Repository;
SyncResult result = Context.SyncSources(dbProvider, new SourceSettings { SourceTypes = new List<Type> { typeof(Order) } });
if(result.AliasesToReindex.Count > 0)
Context.Reindex(dbProvider, result.AliasesToReindex);
foreach(EmbeddedSourceMismatch mismatch in result.SourcesOutOfSync)
Console.WriteLine(mismatch.Message);