public void Initialize(IConfiguration config, IWebHostEnvironment env) { var dc = new DefaultDataContextLoader().GetDefaultDc(); var assemblies = (string[])AppDomain.CurrentDomain.GetData("Assemblies"); var instances = TypeHelper.GetInstanceWithInterface <IHookDbInitializer>(assemblies); // initial app db order by priority instances.OrderBy(x => x.Priority).ToList() .ForEach(instance => { Console.WriteLine($"DbInitializer: {instance.ToString()}"); dc.Transaction <IDbRecord>(() => instance.Load(dc)); }); }
public void Initialize(IConfiguration config, IHostingEnvironment env) { var dc = new DefaultDataContextLoader().GetDefaultDc(); // Amend table structure var instances = TypeHelper.GetInstanceWithInterface <IHookDbInitializer>("Voicebot.Core"); // initial app db order by priority instances.OrderBy(x => x.Priority).ToList() .ForEach(instance => { Console.WriteLine($"DbInitializer: {instance.ToString()}"); dc.Transaction <IDbRecord>(() => instance.Load(dc)); }); }
public async Task <string> Run([FromRoute] string workflowId, [FromBody] JObject data) { var dc = new DefaultDataContextLoader().GetDefaultDc(); var wf = new WorkflowEngine { WorkflowId = workflowId, TransactionId = Guid.NewGuid().ToString(), SignalHub = hub }; dc.Transaction <IDbRecord>(async delegate { await wf.Run(dc, data); }); return(wf.TransactionId); }