GetLatest() private method

private GetLatest ( DbPlatform dbPlatform ) : ProviderInfo
dbPlatform DbPlatform
return ProviderInfo
示例#1
0
        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);
        }
示例#2
0
 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);
 }
示例#3
0
 public void TestGetLatestWhenThereIsOnlyOlderProviders()
 {
     var locator = new ProviderLocator(new ProviderFactory());
     ProviderInfo info = locator.GetLatest(DbPlatform.SqlServer2014);
     Assert.AreEqual("SqlServer2012Provider", info.Provider.GetType().Name);
 }
示例#4
0
 public void TestGetLatestWhenThereIsMatchingProvider()
 {
     var locator = new ProviderLocator(new ProviderFactory());
     ProviderInfo info = locator.GetLatest(DbPlatform.SqlServer2008);
     Assert.AreEqual("SqlServer2008Provider", info.Provider.GetType().Name);
 }