コード例 #1
0
        public async Task FillAsync(ProviderType providerType, Func <IDbConnection> getConnection, string connectionName)
        {
            try
            {
                if (Analyzers.ContainsKey(providerType))
                {
                    _providerType  = providerType;
                    _getConnection = getConnection;
                    _aliasManager.ConnectionName = connectionName;
                    await RefreshAsync();
                }

                IsSchemaSupported = Analyzers.ContainsKey(providerType);
                SchemaInspected?.Invoke(this, new EventArgs());
            }
            catch (Exception exc)
            {
                MessageBox.Show(exc.Message);
            }
        }
コード例 #2
0
ファイル: ProviderManager.cs プロジェクト: JaCraig/Holmes
        /// <summary>
        /// Analyzes the specified connection.
        /// </summary>
        /// <param name="connection">The connection.</param>
        /// <returns>The results</returns>
        public async Task <IEnumerable <Finding> > AnalyzeAsync(IConnection connection)
        {
            if (connection is null || !Analyzers.ContainsKey(connection.Factory))
            {
                return(Array.Empty <Finding>());
            }
            Batch.CreateBatch(connection);
            var AnalyzersUsed = Analyzers[connection.Factory].ToArray();

            for (int x = 0; x < AnalyzersUsed.Length; ++x)
            {
                AnalyzersUsed[x].AddQuery(Batch);
            }
            var Result = await Batch.ExecuteAsync().ConfigureAwait(false);

            var ReturnValue = new List <Finding>();

            for (int x = 0; x < AnalyzersUsed.Length; ++x)
            {
                ReturnValue.Add(AnalyzersUsed[x].Analyze(Result[x]));
            }
            return(ReturnValue);
        }