Exemple #1
0
        protected CollectorDbTestBase()
        {
            AnOperatingSystem.SetCachedAdaptersPath(AnOperatingSystem.GetAdaptersPath(Settings.GetSetting(Settings.AdaptersPathKey), ""));

            DatabaseAdapterHelper.LoadAdapters(out var sqlServerConnection, out var postgresConnection);

            SqlServerConnection = sqlServerConnection;
            PostgresConnection  = postgresConnection;

            IsSqlServerConnected = SqlServerConnection?.Connect(DatabaseAdapterHelper.SqlServerAdapterCollectorConnectionString, 0) ?? false;

            IsPostgresConnected = PostgresConnection?.Connect(DatabaseAdapterHelper.PostgresAdapterCollectorConnectionString, 0) ?? false;
        }
Exemple #2
0
        public static void LoadAdapters(out ISecureSyncDatabaseAdapter sqlServerConnection, out ISecureSyncDatabaseAdapter postgresConnection)
        {
            sqlServerConnection = null;
            postgresConnection  = null;

            var sqlServerAssembly = Assembly.LoadFrom($"{AnOperatingSystem.AppendDirectorySeperatorChar(AnOperatingSystem.GetAdaptersPath(Settings.GetSetting(Settings.AdaptersPathKey), ""))}{SqlServerAdapterDllName}");

            var sqlServerAdapterType = sqlServerAssembly.GetType(SqlServerAdapterClassName);

            if (sqlServerAdapterType != null)
            {
                sqlServerConnection = Activator.CreateInstance(sqlServerAdapterType) as ISecureSyncDatabaseAdapter;
            }

            var postgresAssembly = Assembly.LoadFrom($"{AnOperatingSystem.AppendDirectorySeperatorChar(AnOperatingSystem.GetAdaptersPath(Settings.GetSetting(Settings.AdaptersPathKey), ""))}{PostgresAdapterDllName}");

            var postgresAdapterType = postgresAssembly.GetType(PostgresAdapterClassName);

            if (postgresAdapterType != null)
            {
                postgresConnection = Activator.CreateInstance(postgresAdapterType) as ISecureSyncDatabaseAdapter;
            }
        }