Beispiel #1
0
        public Driver(Configuration Config, ICommandPostProcessor parameterHandler = null)
        {
            this.config           = Config;
            this.commandProcessor = parameterHandler;
            this.connections      = new HashSet <SqlConnection>();
            for (int i = 0; i < this.config.WorkerThreads; i++)
            {
                var connection = new SqlConnection(Config.ConnectionString);
                connection.InfoMessage += delegate(object sender, SqlInfoMessageEventArgs e)
                {
                    var handler = SqlInfo;
                    if (handler != null)
                    {
                        handler(sender, e);
                    }
                };
                this.connections.Add(connection);
            }

            this.Error += (o, e) =>
            {
                if (!string.IsNullOrWhiteSpace(this.config.FailedQueriesLog))
                {
                    lock (lockFailedQueriesLog)
                    {
                        File.AppendAllText(this.config.FailedQueriesLog, JsonConvert.SerializeObject(e.Query));
                    }
                }
            };
        }
Beispiel #2
0
 public IssueCommand(OwinMiddleware next, ExclusiveHandlerCommandBus commandBus, ICommandPostProcessor postProcessor) : base(next)
 {
     this.commandBus    = commandBus;
     this.postProcessor = postProcessor;
 }