/// <inheritdoc/> protected override DataSet CreateDataSet() { DataSet dataset = base.CreateDataSet(); if (string.IsNullOrWhiteSpace(JsonData)) { throw new Exception("Data is empty."); } if (JsonData.Trim().StartsWith("[")) { JsonData = "{\"Data\":" + JsonData + "}"; } var type = JsonCompiler.Compile(JsonData); var properties = type.GetProperties(); var obj = JsonConvert.DeserializeObject(JsonData, type); foreach (var prop in properties) { IList list = prop.GetValue(obj, null) as IList; if (list != null) { DataTable dataTable = ToDataTable(list); dataTable.TableName = prop.Name; dataset.Tables.Add(dataTable); } } return(dataset); }
public FunctionCompiler(Assembly configurationSourceAssembly, string outputBinaryFolder, CompileTargetEnum compileTarget, ICompilerLog compilerLog) { _configurationSourceAssembly = configurationSourceAssembly; _outputBinaryFolder = outputBinaryFolder; _compileTarget = compileTarget; _compilerLog = compilerLog; _serviceCollection = new ServiceCollection(); CommandingDependencyResolverAdapter adapter = new CommandingDependencyResolverAdapter( (fromType, toInstance) => _serviceCollection.AddSingleton(fromType, toInstance), (fromType, toType) => _serviceCollection.AddTransient(fromType, toType), (resolveType) => null // we never resolve during compilation ); _commandRegistry = adapter.AddCommanding(); _assemblyCompiler = new AssemblyCompiler(compilerLog); _triggerReferenceProvider = new TriggerReferenceProvider(); _jsonCompiler = new JsonCompiler(); _openApiCompiler = new OpenApiCompiler(); }
/// <summary> /// Initializes a new instance of the <see cref="CsvCompilerModule"/> class. /// </summary> public JsonCompilerModule(Bootstrapper bootstrapper) : base(bootstrapper) { jsonCompiler = new JsonCompiler(); }