Пример #1
0
 protected override Type ResolveConnectionType()
 {
     if (!string.IsNullOrEmpty(ConnectionStringName) && string.IsNullOrEmpty(ConnectionString))
     {
         try
         {
             ConnectionString = DbRegistry.GetConnectionString(ConnectionStringName).ConnectionString;
             using (var connection = DbRegistry.CreateDbConnection(ConnectionStringName))
             {
                 ConnectionType = connection.GetType().AssemblyQualifiedName;
             }
         }
         catch (Exception exception)
         {
             ErrorHandler.Error("Failed to load resolve connection [" + ConnectionStringName + "]", exception);
             throw;
         }
     }
     return(base.ResolveConnectionType());
 }
Пример #2
0
 public void RegistryTest()
 {
     Assert.AreEqual(cs, DbRegistry.GetConnectionString(dbId));
     Assert.IsTrue(DbRegistry.IsDatabaseRegistered(dbId));
     Assert.IsNotNull(DbRegistry.CreateDbConnection(dbId));
 }