private static DataSource CreateSqlDataSource( string name, string sqlConnectionString, string tableOrViewName, string description, DataChangeDetectionPolicy changeDetectionPolicy = null, DataDeletionDetectionPolicy deletionDetectionPolicy = null) { Throw.IfArgumentNullOrEmpty(name, nameof(name)); Throw.IfArgumentNullOrEmpty(tableOrViewName, nameof(tableOrViewName)); Throw.IfArgumentNullOrEmpty(sqlConnectionString, nameof(sqlConnectionString)); return(new DataSource() { Type = DataSourceType.AzureSql, Name = name, Description = description, Container = new DataContainer() { Name = tableOrViewName }, Credentials = new DataSourceCredentials(sqlConnectionString), DataChangeDetectionPolicy = changeDetectionPolicy, DataDeletionDetectionPolicy = deletionDetectionPolicy }); }
private static void AssertDataChangeDetectionPoliciesEqual(DataChangeDetectionPolicy expected, DataChangeDetectionPolicy actual) { if (expected == null) { Assert.Null(actual); return; } Assert.NotNull(actual); HighWaterMarkChangeDetectionPolicy expectedHwm = expected as HighWaterMarkChangeDetectionPolicy; if (expectedHwm != null) { HighWaterMarkChangeDetectionPolicy actualHwm = Assert.IsType <HighWaterMarkChangeDetectionPolicy>(actual); Assert.Equal(expectedHwm.HighWaterMarkColumnName, actualHwm.HighWaterMarkColumnName); return; } SqlIntegratedChangeTrackingPolicy expectedIct = expected as SqlIntegratedChangeTrackingPolicy; if (expectedIct != null) { Assert.IsType <SqlIntegratedChangeTrackingPolicy>(actual); return; } Assert.False(true, "Unexpected type of change detection policy (did you forget to add support for a new policy type to test code?):" + expected.GetType().Name); }
/// <summary> /// Creates a new DataSource to connect to a VM-hosted SQL Server database with change detection enabled. /// </summary> /// <param name="name">The name of the datasource.</param> /// <param name="sqlConnectionString">The connection string for the SQL Server database.</param> /// <param name="tableOrViewName">The name of the table or view from which to read rows.</param> /// <param name="changeDetectionPolicy">The change detection policy for the datasource.</param> /// <param name="description">Optional. Description of the datasource.</param> /// <returns>A new DataSource instance.</returns> public static DataSource SqlServerOnAzureVM( string name, string sqlConnectionString, string tableOrViewName, DataChangeDetectionPolicy changeDetectionPolicy, string description = null) { return(AzureSql(name, sqlConnectionString, tableOrViewName, changeDetectionPolicy, description)); }
/// <summary> /// Creates a new DataSource to connect to an Azure SQL database with change detection enabled. /// </summary> /// <param name="name">The name of the datasource.</param> /// <param name="sqlConnectionString">The connection string for the Azure SQL database.</param> /// <param name="tableOrViewName">The name of the table or view from which to read rows.</param> /// <param name="changeDetectionPolicy">The change detection policy for the datasource.</param> /// <param name="description">Optional. Description of the datasource.</param> /// <returns>A new DataSource instance.</returns> public static DataSource AzureSql( string name, string sqlConnectionString, string tableOrViewName, DataChangeDetectionPolicy changeDetectionPolicy, string description = null) { Throw.IfArgumentNull(changeDetectionPolicy, nameof(changeDetectionPolicy)); return(CreateSqlDataSource(name, sqlConnectionString, tableOrViewName, description, changeDetectionPolicy)); }
internal DataSource(string name, string description, DataSourceType type, DataSourceCredentials credentials, DataContainer container, DataChangeDetectionPolicy dataChangeDetectionPolicy, DataDeletionDetectionPolicy dataDeletionDetectionPolicy, string eTag) { Name = name; Description = description; Type = type; Credentials = credentials; Container = container; DataChangeDetectionPolicy = dataChangeDetectionPolicy; DataDeletionDetectionPolicy = dataDeletionDetectionPolicy; ETag = eTag; }
private static DataSource CreateTestDataSource( DataSourceType type, DataChangeDetectionPolicy changeDetectionPolicy = null, DataDeletionDetectionPolicy deletionDetectionPolicy = null) { return (new DataSource( TestUtilities.GenerateName(), type, new DataSourceCredentials(connectionString: "fake"), new DataContainer("faketable")) { DataChangeDetectionPolicy = changeDetectionPolicy, DataDeletionDetectionPolicy = deletionDetectionPolicy, }); }
private static DataSource CreateTestSqlDataSource(DataChangeDetectionPolicy changeDetectionPolicy, bool useSqlVm = false) { // Test different overloads based on the given parameters. if (useSqlVm) { return(DataSource.SqlServerOnAzureVM( name: SearchTestUtilities.GenerateName(), sqlConnectionString: IndexerFixture.AzureSqlReadOnlyConnectionString, tableOrViewName: IndexerFixture.AzureSqlTestTableName, changeDetectionPolicy: changeDetectionPolicy, description: FakeDescription)); } else { return(DataSource.AzureSql( name: SearchTestUtilities.GenerateName(), sqlConnectionString: IndexerFixture.AzureSqlReadOnlyConnectionString, tableOrViewName: IndexerFixture.AzureSqlTestTableName, changeDetectionPolicy: changeDetectionPolicy, description: FakeDescription)); } }