コード例 #1
0
        public ClientManager(ITaskRepository taskRepository, IExpressionConverter expressionConverter, IJsonConverter jsonConverter, IUnitOfWorkFactory unitOfWorkFactory, IContextSettings contextSettings, ClientManagerConfiguration managerConfiguration) : base(managerConfiguration)
        {
            if (taskRepository == null)
            {
                throw new ArgumentNullException(nameof(taskRepository));
            }
            if (expressionConverter == null)
            {
                throw new ArgumentNullException(nameof(expressionConverter));
            }
            if (jsonConverter == null)
            {
                throw new ArgumentNullException(nameof(jsonConverter));
            }
            if (unitOfWorkFactory == null)
            {
                throw new ArgumentNullException(nameof(unitOfWorkFactory));
            }
            if (contextSettings == null)
            {
                throw new ArgumentNullException(nameof(contextSettings));
            }

            this.taskRepository      = taskRepository;
            this.expressionConverter = expressionConverter;
            this.jsonConverter       = jsonConverter;
            this.unitOfWorkFactory   = unitOfWorkFactory;
            this.contextSettings     = contextSettings;
        }
コード例 #2
0
 public InputProcessor()
 {
     expressionConverter = new SimpleExpressionConverter();
     tokenizer           = new SimpleTokenizer();
     parser = new PolynomialParser(tokenizer);
     sorter = new Sorter <PolynomialNode <double> >();
 }
コード例 #3
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="converter"></param>
        /// <param name="method"></param>
        /// <returns></returns>
        public override ExpressionElement Convert(IExpressionConverter converter, MethodCallExpression method)
        {
            var index = method.SkipMethodChain(0);
            var args = method.Arguments.Skip(index).Select(e => converter.Convert(e)).ToArray();
            var name = string.IsNullOrEmpty(Name) ? method.Method.Name.ToUpper() : Name;

            var hArgs = new HText(args) { Separator = Separator }.ConcatToBack(")");
            return new HText(Line(name, "("), hArgs) { IsFunctional = true };
        }
コード例 #4
0
 public DbContextRepository(
     DbContext context,
     IEnumerable <IRepositoryEvents <Model> > events,
     IModelConverter modelConverter,
     IExpressionConverter expressionConverter
     )
     : base(context, events, modelConverter, expressionConverter)
 {
 }
コード例 #5
0
 public override ExpressionElement Convert(IExpressionConverter converter, MethodCallExpression method)
 {
     var v = new VText();
     var overMethod = method;
     v.Add(overMethod.Method.Name.ToUpper() + "(");
     v.AddRange(1, overMethod.Arguments.Skip(1).
         Where(e => !(e is ConstantExpression)). //Skip null.
         Select(e => converter.Convert(e)).ToArray());
     return v.ConcatToBack(")");
 }
コード例 #6
0
 public DbContextRepository(
     DbContext context,
     IEnumerable <IRepositoryEvents <Model> > events,
     IModelConverter modelConverter,
     IExpressionConverter expressionConverter
     )
 {
     _context             = context;
     _events              = events;
     _modelConverter      = modelConverter;
     _expressionConverter = expressionConverter;
 }
コード例 #7
0
        public override ExpressionElement Convert(IExpressionConverter converter, MethodCallExpression method)
        {
            var arg = method.Arguments[method.SkipMethodChain(0)];
            var array = arg as NewArrayExpression;

            var orderBy = new VText();
            orderBy.Add("ORDER BY");
            var sort = new VText() { Separator = "," };
            sort.AddRange(1, array.Expressions.Select(e => converter.Convert(e)).ToList());
            orderBy.Add(sort);
            return orderBy;
        }
コード例 #8
0
        public TaskBuilder(IExpressionConverter expressionConverter, IJsonConverter jsonConverter)
        {
            if (expressionConverter == null)
            {
                throw new ArgumentNullException(nameof(expressionConverter));
            }
            if (jsonConverter == null)
            {
                throw new ArgumentNullException(nameof(jsonConverter));
            }

            this.expressionConverter = expressionConverter;
            this.jsonConverter       = jsonConverter;
        }
コード例 #9
0
ファイル: TaskConverter.cs プロジェクト: crazyants/WiseQueue
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="expressionConverter">The <see cref="IExpressionConverter"/> instance.</param>
        /// <param name="jsonConverter">JSON converter.</param>
        /// <param name="loggerFactory">The <see cref="ICommonLoggerFactory"/> instance.</param>
        /// <exception cref="ArgumentNullException"><paramref name="expressionConverter"/> is <see langword="null" />.</exception>
        /// <exception cref="ArgumentNullException"><paramref name="jsonConverter"/> is <see langword="null" />.</exception>
        /// <exception cref="ArgumentNullException"><paramref name="loggerFactory"/> is <see langword="null" />.</exception>
        public TaskConverter(IExpressionConverter expressionConverter, IJsonConverter jsonConverter, ICommonLoggerFactory loggerFactory) : base(loggerFactory)
        {
            if (expressionConverter == null)
            {
                throw new ArgumentNullException("expressionConverter");
            }
            if (jsonConverter == null)
            {
                throw new ArgumentNullException("jsonConverter");
            }

            this.expressionConverter = expressionConverter;
            this.jsonConverter       = jsonConverter;
        }
コード例 #10
0
        public override ExpressionElement Convert(IExpressionConverter converter, MethodCallExpression method)
        {
            var partitionBy = new VText();
            partitionBy.Add("PARTITION BY");

            var elements = new VText() { Indent = 1, Separator = "," };
            var array = method.Arguments[0] as NewArrayExpression;
            foreach (var e in array.Expressions.Select(e => converter.Convert(e)))
            {
                elements.Add(e);
            }
            partitionBy.Add(elements);

            return partitionBy;
        }
コード例 #11
0
ファイル: TaskManager.cs プロジェクト: crazyants/WiseQueue
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="expressionConverter">The <see cref="IExpressionConverter"/> instance.</param>
        /// <param name="taskDataContext">The <see cref="ITaskDataContext"/> instance.</param>
        /// <param name="serverManager">The <see cref="IQueueManager"/> instance.</param>
        /// <param name="queueManager">The <see cref="IServerManager"/> instance.</param>
        /// <param name="loggerFactory">The <see cref="ICommonLoggerFactory"/> instance.</param>
        /// <exception cref="ArgumentNullException"><paramref name="expressionConverter"/> is <see langword="null" />.</exception>
        /// <exception cref="ArgumentNullException"><paramref name="taskDataContext"/> is <see langword="null" />.</exception>
        /// <exception cref="ArgumentNullException"><paramref name="serverManager"/> is <see langword="null" />.</exception>
        /// <exception cref="ArgumentNullException"><paramref name="queueManager"/> is <see langword="null" />.</exception>
        public TaskManager(TaskManagerConfiguration taskManagerConfiguration, ITaskBuilder taskBuilder, IExpressionConverter expressionConverter, ITaskDataContext taskDataContext, IServerManager serverManager, IQueueManager queueManager, ICommonLoggerFactory loggerFactory)
            : base("Task Manager", loggerFactory)
        {
            if (taskManagerConfiguration == null)
            {
                throw new ArgumentNullException(nameof(taskManagerConfiguration));
            }
            if (taskBuilder == null)
            {
                throw new ArgumentNullException(nameof(taskBuilder));
            }
            if (expressionConverter == null)
            {
                throw new ArgumentNullException("expressionConverter");
            }
            if (taskDataContext == null)
            {
                throw new ArgumentNullException("taskDataContext");
            }
            if (serverManager == null)
            {
                throw new ArgumentNullException("serverManager");
            }
            if (queueManager == null)
            {
                throw new ArgumentNullException("queueManager");
            }

            this.taskBuilder         = taskBuilder;
            this.expressionConverter = expressionConverter;
            this.taskDataContext     = taskDataContext;
            this.serverManager       = serverManager;
            this.queueManager        = queueManager;

            activeTasks = new Dictionary <Int64, IRunningTask>();

            maxRerunCount       = taskManagerConfiguration.MaxRerunAttempts;
            maxTasksPerQueue    = taskManagerConfiguration.MaxTaskPerQueue;
            timeShiftAfterCrash = taskManagerConfiguration.TimeShiftAfterCrash;
            taskManagerState    = taskManagerConfiguration.State;
        }
コード例 #12
0
 public override ExpressionElement Convert(IExpressionConverter converter, MethodCallExpression method)
 {
     var args = method.Arguments.Select(e => converter.Convert(e)).ToArray();
     return Clause(LineSpace(args[0], "BETWEEN"), args[1], "AND", args[2]);
 }
コード例 #13
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="converter"></param>
 /// <param name="member"></param>
 /// <returns></returns>
 public override ExpressionElement Convert(IExpressionConverter converter, MemberExpression member)
     => string.IsNullOrEmpty(Name) ? member.Member.Name.ToUpper() : Name;
コード例 #14
0
 public void Setup()
 {
     _converter = new ExpressionConverter();
 }
コード例 #15
0
 public override ExpressionElement Convert(IExpressionConverter converter, NewExpression exp)
 {
     ExpressionElement arg1 = converter.Convert(exp.Arguments[0]).Customize(new CustomizeColumnOnly());
     return new HText(arg1, "=", converter.Convert(exp.Arguments[1])) { Separator = " " };
 }
コード例 #16
0
 public ExpressionCompiler(IExpressionConverter expressionConverter, ICompileStrategyFactory compileStrategyFactory)
 {
     _expressionConverter    = expressionConverter;
     _compileStrategyFactory = compileStrategyFactory;
 }
コード例 #17
0
 public void Setup()
 {
     _converter = new ExpressionConverter();
 }
コード例 #18
0
 public override ExpressionElement Convert(IExpressionConverter converter, MethodCallExpression method)
 {
     var args = method.Arguments.Select(e => converter.Convert(e)).ToArray();
     return FuncSpace("CAST", args[0], "AS", args[1].Customize(new CustomizeParameterToObject()));
 }
コード例 #19
0
 public override ExpressionElement Convert(IExpressionConverter converter, MethodCallExpression method)
     => LineSpace(converter.Convert(method.Arguments[0]), method.Method.Name.ToUpper());
コード例 #20
0
 public override ExpressionElement Convert(IExpressionConverter converter, MethodCallExpression method)
 {
     var text = (string)converter.ToObject(method.Arguments[0]);
     var array = method.Arguments[1] as NewArrayExpression;
     return new StringFormatText(text, array.Expressions.Select(e => converter.Convert(e)).ToArray());
 }
コード例 #21
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="converter"></param>
 /// <param name="exp"></param>
 /// <returns></returns>
 public abstract ExpressionElement Convert(IExpressionConverter converter, MemberExpression exp);
コード例 #22
0
ファイル: ExpressionCompiler.cs プロジェクト: Eagle-Chan/KIS
 public ExpressionCompiler(IExpressionConverter expressionConverter, ICompileStrategyFactory compileStrategyFactory)
 {
     _expressionConverter = expressionConverter;
     _compileStrategyFactory = compileStrategyFactory;
 }
コード例 #23
0
 public override ExpressionElement Convert(IExpressionConverter converter, NewExpression exp)
 {
     var obj = converter.ToObject(exp.Arguments[0]);
     return (bool)obj ? converter.Convert(exp.Arguments[1]) : (ExpressionElement)string.Empty;
 }
コード例 #24
0
 public override ExpressionElement Convert(IExpressionConverter converter, MethodCallExpression method)
     => new CurrentDateTimeExpressionElement(Name);
コード例 #25
0
 public override ExpressionElement Convert(IExpressionConverter converter, MethodCallExpression method)
 {
     var args = method.Arguments.Select(e => converter.Convert(e)).ToArray();
     return new DisableBracketsText(Func("ALL", args[0]));
 }
コード例 #26
0
ファイル: ExpressionCompiler.cs プロジェクト: nxoxn/EPPlus
 /// <summary>
 /// Instantiates a new <see cref="ExpressionCompiler"/> object.
 /// </summary>
 public ExpressionCompiler()
 {
     _expressionConverter = new ExpressionConverter();
 }