예제 #1
0
        public async Task <HttpResponseMessage> GetTableInfo(HttpRequestMessage request, [FromBody] CreateTableScriptViewModel vm)
        {
            IDataGenStrategy dataGenStrategy = DataGenStrategies[vm.SqlType];
            TableInfo        tableInfo       = await dataGenStrategy.GetTableInfoAsync(vm.CreateTableScript);

            TableInfoViewModel tableInfoViewModel = new TableInfoViewModel {
                TableInfo = tableInfo
            };
            HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK, tableInfoViewModel);

            return(response);
        }
예제 #2
0
        public async Task <HttpResponseMessage> GetGeneratedData(HttpRequestMessage request, [FromBody] TableInfoViewModel vm)
        {
            IDataGenStrategy dataGenStrategy = DataGenStrategies[vm.SqlType];
            var generationOptions            = new InsertScriptGenerationOptions {
                RowCount = vm.EntityCount
            };
            string generatedData = await dataGenStrategy.GenerateInsertScriptAsync(vm.TableInfo, generationOptions);

            GeneratedDataViewModel generatedDataViewModel = new GeneratedDataViewModel
            {
                GeneratedData = generatedData
            };
            HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK, generatedDataViewModel);

            return(response);
        }