Example #1
0
        private static void PerformDump(DumpConfig dumpConfig)
        {
            EnsureDirectoryExists(dumpConfig.OutputDirectory);

            using (var connection = new SqlConnection(dumpConfig.ConnectionString))
            {
                connection.Open();

                var tablesToDump = TableNameGenerator.GetTablesToDump(connection, dumpConfig);

                var iFile = 1;
                var first = true;
                foreach (var table in tablesToDump)
                {
                    if (first)
                    {
                        first = false;
                    }
                    else
                    {
                        Console.WriteLine();
                    }

                    var fileNamePrefix = dumpConfig.FileNamePrefix + iFile.ToString("D3") + "_";

                    var filePath = dumpConfig.OutputDirectory + "/" + fileNamePrefix + table.Schema + "_" + table.Name + dumpConfig.FileNameSuffix + ".sql";
                    Console.WriteLine($"Creating file: {filePath}");

                    TableDumpScriptGenerator.DumpTable(connection, dumpConfig, table, filePath);
                    iFile++;
                }
            }
        }
Example #2
0
 public Context(Project project)
 {
     TableNameGenerator = new TableNameGenerator(project);
     ViewNameGenerator  = new ViewNameGenerator(project);
     TableNameMap       = new Dictionary <string, string>();
     ViewIdMap          = new Dictionary <int, int>();
     FieldIdMap         = new Dictionary <int, int>();
 }
Example #3
0
        private async Task OnOpenAsync(TimeSpan timeout)
        {
            var cloudTableClient = this.storageAccount.CreateCloudTableClient();
            var requestTable     = cloudTableClient.GetTableReference(TableNameGenerator.GetRequestTableName(this.TableName));
            await requestTable.CreateIfNotExistsAsync().ConfigureAwait(false);

            var replyTable = cloudTableClient.GetTableReference(TableNameGenerator.GetResponseTableName(this.TableName));
            await replyTable.CreateIfNotExistsAsync().ConfigureAwait(false);
        }