private RuntimeConfiguration CreateRuntimeConfiguration(string connectionString, DbPlatform dbPlatform, DbAltererOptions options) { var providerLocator = new ProviderLocator(new ProviderFactory()); // CLEAN: use DI container var providerInfo = providerLocator.GetLatest(dbPlatform); var validatorFactory = new ValidatorFactory(providerInfo, options, providerLocator); var validator = validatorFactory.Create(); var connectionInfo = new ConnectionInfo(connectionString, providerInfo.Metadata.InvariantName, providerInfo.Metadata.SupportsTransactions, providerInfo.Metadata.EnableAnsiQuotesCommand); var sqlDispatcher = new SqlDispatcher(options.GetScriptingOptions(), providerInfo.Provider, providerInfo.Metadata); return new RuntimeConfiguration(providerInfo, connectionInfo, validator, sqlDispatcher); }
public void TestGetLatestWhenThereIsNoMatchingProviders() { var locator = new ProviderLocator(new ProviderFactory()); ProviderInfo info = locator.GetLatest(new DbPlatform(Platform.SqlServer, 8)); Assert.AreEqual("SqlServer2000Provider", info.Provider.GetType().FullName); }
public void TestGetLatestWhenThereIsOnlyOlderProviders() { var locator = new ProviderLocator(new ProviderFactory()); ProviderInfo info = locator.GetLatest(DbPlatform.SqlServer2014); Assert.AreEqual("SqlServer2012Provider", info.Provider.GetType().Name); }
public void TestGetLatestWhenThereIsMatchingProvider() { var locator = new ProviderLocator(new ProviderFactory()); ProviderInfo info = locator.GetLatest(DbPlatform.SqlServer2008); Assert.AreEqual("SqlServer2008Provider", info.Provider.GetType().Name); }