AliaSQL.Core.Services.Impl.QueryExecutor.GetExecutedTestDataScripts C# (CSharp) Method

GetExecutedTestDataScripts() public method

public GetExecutedTestDataScripts ( AliaSQL.Core.Model.ConnectionSettings settings ) : List
settings AliaSQL.Core.Model.ConnectionSettings
return List
        public List<string> GetExecutedTestDataScripts(ConnectionSettings settings)
        {
            var executedfiles = new List<string>();
            using (var connection = new SqlConnection(_connectionStringGenerator.GetConnectionString(settings, true)))
            {
                connection.Open();
                using (var command = new SqlCommand())
                {
                    command.Connection = connection;
                    command.CommandText = "if OBJECT_ID('usd_AppliedDatabaseTestDataScript', 'U') is not null select ScriptFile from usd_AppliedDatabaseTestDataScript else select top(0) null as ScriptFile ";
                    using (SqlDataReader reader = command.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            string item = reader[0].ToString();
                            executedfiles.Add(item);
                        }
                    }
                }
            }
            return executedfiles;
        }