コード例 #1
0
ファイル: DbInitializer.cs プロジェクト: zhamppx97/BotSharp
        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));
            });
        }
コード例 #2
0
ファイル: DbInitializer.cs プロジェクト: voicecoin/VoiceBot
        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));
            });
        }
コード例 #3
0
        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);
        }