Example #1
0
        // 9
        /// <summary>
        /// Creates a synchronization agent that will handle a full synchronization between a client and a server.
        /// </summary>
        /// <param name="clientProvider">local provider to your client database</param>
        /// <param name="remoteOrchestrator">Remote Orchestrator already configured with a SyncProvider</param>
        /// <param name="options">Sync Options defining options used by your local provider (and remote provider if type of remoteOrchestrator is not a WebRemoteOrchestrator)</param>
        public SyncAgent(CoreProvider clientProvider, RemoteOrchestrator remoteOrchestrator, SyncOptions options = default)
            : this()
        {
            if (clientProvider is null)
            {
                throw new ArgumentNullException(nameof(clientProvider));
            }
            if (remoteOrchestrator is null)
            {
                throw new ArgumentNullException(nameof(remoteOrchestrator));
            }
            if (options == default)
            {
                options = new SyncOptions();
            }

            // Override remote orchestrator options, setup and scope name
            remoteOrchestrator.Options = options;

            var localOrchestrator = new LocalOrchestrator(clientProvider, options);

            this.LocalOrchestrator  = localOrchestrator;
            this.RemoteOrchestrator = remoteOrchestrator;
            this.EnsureOptionsAndSetupInstances();
        }
Example #2
0
        // 10
        /// <summary>
        /// Creates a synchronization agent that will handle a full synchronization between a client and a server.
        /// </summary>
        /// <param name="localOrchestrator">Local Orchestrator already configured with a SyncProvider</param>
        /// <param name="remoteOrchestrator">Remote Orchestrator already configured with a SyncProvider</param>
        /// <param name="scopeName">scope name</param>
        public SyncAgent(LocalOrchestrator localOrchestrator, RemoteOrchestrator remoteOrchestrator) : this()
        {
            if (localOrchestrator is null)
            {
                throw new ArgumentNullException(nameof(localOrchestrator));
            }
            if (remoteOrchestrator is null)
            {
                throw new ArgumentNullException(nameof(remoteOrchestrator));
            }

            this.LocalOrchestrator  = localOrchestrator;
            this.RemoteOrchestrator = remoteOrchestrator;
            this.EnsureOptionsAndSetupInstances();
        }
Example #3
0
        // 4
        /// <summary>
        /// Creates a synchronization agent that will handle a full synchronization between a client and a server.
        /// </summary>
        /// <param name="clientProvider">Local Provider connecting to your client database</param>
        /// <param name="serverProvider">Local Provider connecting to your server database</param>
        /// <param name="options">Sync Options defining options used by your local and remote provider</param>
        public SyncAgent(CoreProvider clientProvider, CoreProvider serverProvider, SyncOptions options = default)
            : this()
        {
            if (clientProvider is null)
            {
                throw new ArgumentNullException(nameof(clientProvider));
            }
            if (serverProvider is null)
            {
                throw new ArgumentNullException(nameof(serverProvider));
            }
            if (options == null)
            {
                options = new SyncOptions();
            }

            // Affect local and remote orchestrators
            this.LocalOrchestrator  = new LocalOrchestrator(clientProvider, options);
            this.RemoteOrchestrator = new RemoteOrchestrator(serverProvider, options);

            this.EnsureOptionsAndSetupInstances();
        }
Example #4
0
 /// <summary>
 /// Intercept the provider action when a scope is loaded from Server database
 /// </summary>
 public static Guid OnServerScopeInfoLoaded(this RemoteOrchestrator orchestrator, Func <ServerScopeInfoLoadedArgs, Task> action)
 => orchestrator.AddInterceptor(action);
Example #5
0
 /// <summary>
 /// Intercept the provider action when a server scope is about to be loaded from server database
 /// </summary>
 public static Guid OnServerScopeInfoLoading(this RemoteOrchestrator orchestrator, Action <ServerScopeInfoLoadingArgs> action)
 => orchestrator.AddInterceptor(action);