Exemplo n.º 1
0
        public override RemoteOrchestrator CreateRemoteOrchestrator(ProviderType providerType, string dbName)
        {
            var cs           = HelperDatabase.GetConnectionString(ProviderType.MySql, dbName);
            var orchestrator = new RemoteOrchestrator(new MySqlSyncProvider(cs));

            return(orchestrator);
        }
        public T CreateOrchestrator <T>(ProviderType providerType, string dbName, bool useChangeTracking = false) where T : IOrchestrator
        {
            // Get connection string
            var cs = HelperDatabase.GetConnectionString(providerType, dbName);

            IOrchestrator orchestrator = null;

            if (typeof(T) == typeof(RemoteOrchestrator))
            {
                orchestrator = new RemoteOrchestrator();
            }
            else if (typeof(T) == typeof(LocalOrchestrator))
            {
                orchestrator = new LocalOrchestrator();
            }
            else if (typeof(T) == typeof(WebServerOrchestrator))
            {
                orchestrator = new WebServerOrchestrator();
            }

            if (orchestrator == null)
            {
                throw new Exception("Orchestrator does not exists");
            }

            switch (providerType)
            {
            case ProviderType.Sql:
                orchestrator.Provider = useChangeTracking ? new SqlSyncChangeTrackingProvider(cs) : new SqlSyncProvider(cs);
                break;

            case ProviderType.MySql:
                orchestrator.Provider = new MySqlSyncProvider(cs);
                break;

            case ProviderType.Sqlite:
                orchestrator.Provider = new SqliteSyncProvider(cs);
                break;
            }
            return((T)orchestrator);
        }
Exemplo n.º 3
0
        public override LocalOrchestrator CreateLocalOrchestrator(ProviderType providerType, string dbName)
        {
            var cs           = HelperDatabase.GetConnectionString(providerType, dbName);
            var orchestrator = new LocalOrchestrator();

            switch (providerType)
            {
            case ProviderType.Sql:
                orchestrator.Provider = new SqlSyncProvider(cs);
                break;

            case ProviderType.MySql:
                orchestrator.Provider = new MySqlSyncProvider(cs);
                break;

            case ProviderType.Sqlite:
                orchestrator.Provider = new SqliteSyncProvider(cs);
                break;
            }

            return(orchestrator);
        }