Ejemplo n.º 1
0
        public QueryHandlerMiddleware(CqrsFormatterRegistry registry, ICqrsOptions options)
        {
            _registry = registry;
            _options  = options;

            _queryTypes = new Lazy <Dictionary <string, QueryInfo> >(() => options.GetQueryTypes()
                                                                     .SelectMany(x => x.HttpMethods, (ci, method) => new { QueryInfo = ci, HttpMethod = method })
                                                                     .ToDictionary(
                                                                         keySelector: (x) => $"{x.HttpMethod} {options.GetQueryPath(x.QueryInfo)}",
                                                                         elementSelector: x => x.QueryInfo,
                                                                         comparer: StringComparer.OrdinalIgnoreCase));
        }
Ejemplo n.º 2
0
        public CqrsMiddleware(Container container, ICqrsOptions options)
        {
            _container = container;
            _options   = options;
            _jsonSerializerSettings = options.GetJsonSerializerSettings();

            _commandTypes = options.GetCommandTypes().ToDictionary(
                keySelector: options.GetCommandKey,
                elementSelector: type => type,
                comparer: StringComparer.OrdinalIgnoreCase);

            _queryTypes = options.GetQueryTypes().ToDictionary(
                keySelector: options.GetQueryKey,
                elementSelector: info => info,
                comparer: StringComparer.OrdinalIgnoreCase);
        }
Ejemplo n.º 3
0
        public CqrsMiddleware(Container container, CqrsFormatterRegistry registry, ICqrsOptions options)
        {
            _container = container;
            _registry  = registry;
            _options   = options;

            _commandTypes = new Lazy <Dictionary <string, CommandInfo> >(() => options.GetCommandTypes().ToDictionary(
                                                                             keySelector: options.GetCommandKey,
                                                                             elementSelector: type => type,
                                                                             comparer: StringComparer.OrdinalIgnoreCase));

            _queryTypes = new Lazy <Dictionary <string, QueryInfo> >(() => options.GetQueryTypes().ToDictionary(
                                                                         keySelector: options.GetQueryKey,
                                                                         elementSelector: info => info,
                                                                         comparer: StringComparer.OrdinalIgnoreCase));
        }