Ejemplo n.º 1
0
        public static void Drop()
        {
            var databaseBootstrapper = new DatabaseBootstrapper();

            databaseBootstrapper.DropIfExists();

            databaseBootstrapper.ClearPools();
        }
Ejemplo n.º 2
0
        public static void CreateAndPopulate()
        {
            var databaseBootstrapper = new DatabaseBootstrapper();

            var createFiles = Directory.EnumerateFiles(rootDirectory + ScriptsDirectories.CreateScripts);

            databaseBootstrapper.CreateDatabase(createFiles);

            var updateFiles = Directory.EnumerateFiles(rootDirectory + ScriptsDirectories.UpdateScripts);

            databaseBootstrapper.PopulateDatabase(updateFiles);

            var dataFiles = Directory.EnumerateFiles(rootDirectory + ScriptsDirectories.DataScripts);

            databaseBootstrapper.PutDataInDatabase(dataFiles);

            databaseBootstrapper.ClearPools();
        }
Ejemplo n.º 3
0
        public static DataTable ExecuteStoredProcedure(string procedureName)
        {
            DataTable dataTable = new DataTable("Test");

            using (var conn = new SqlConnection(DatabaseBootstrapper.GetConnectionString()))
            {
                conn.Open();

                var command = new SqlCommand(procedureName, conn);

                command.CommandType = CommandType.StoredProcedure;

                using (SqlDataReader dr = command.ExecuteReader())
                {
                    dataTable.Load(dr);
                }

                command.Dispose();
                conn.Close();
            }

            return(dataTable);
        }
Ejemplo n.º 4
0
        public static string GetConnectionString()
        {
            var databaseBootstrapper = new DatabaseBootstrapper();

            return(databaseBootstrapper.GetConnectionString(true));
        }