Ejemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="QueryficationContext"/> class.
        /// </summary>
        /// <param name="configuration">An implementation of the <see cref="IQueryfyConfiguration"/> interface.</param>
        /// <param name="queryficationEngine">An implementation of the <see cref="IQueryficationEngine"/> interface.</param>
        /// <param name="urlValueProcessorFactory">An implementation of the <see cref="IValueProcessorFactory"/> interface.</param>
        /// <param name="lambdaExpressionInitializer">An implementation of the <see cref="ILambdaExpressionInitializer"/> interface.</param>
        /// <param name="instanceFactory">An implementation of the <see cref="IInstanceFactory"/> interface</param>
        /// <exception cref="ArgumentNullException">The value of '<paramref name="configuration"/>', '<paramref name="instanceFactory"/>', '<paramref name="lambdaExpressionInitializer"/>', '<paramref name="queryficationEngine"/>' and '<paramref name="urlValueProcessorFactory"/>' cannot be null. </exception>
        public QueryficationContext([NotNull] IQueryfyConfiguration configuration, [NotNull] IQueryficationEngine queryficationEngine, [NotNull] IValueProcessorFactory urlValueProcessorFactory, [NotNull] ILambdaExpressionInitializer lambdaExpressionInitializer, [NotNull] IInstanceFactory instanceFactory)
        {
            if (configuration == null)
            {
                throw new ArgumentNullException(nameof(configuration));
            }

            if (queryficationEngine == null)
            {
                throw new ArgumentNullException(nameof(queryficationEngine));
            }

            if (urlValueProcessorFactory == null)
            {
                throw new ArgumentNullException(nameof(urlValueProcessorFactory));
            }

            if (lambdaExpressionInitializer == null)
            {
                throw new ArgumentNullException(nameof(lambdaExpressionInitializer));
            }

            if (instanceFactory == null)
            {
                throw new ArgumentNullException(nameof(instanceFactory));
            }

            this.queryficationDictionary     = new QueryficationDictionary();
            this.Configuration               = configuration;
            this.ValueProcessorFactory       = urlValueProcessorFactory;
            this.lambdaExpressionInitializer = lambdaExpressionInitializer;
            this.queryficationEngine         = queryficationEngine;
            this.InstanceFactory             = instanceFactory;
        }
Ejemplo n.º 2
0
        public static Object Initialize <T, TProperty>([NotNull] this ILambdaExpressionInitializer lambdaExpressionInitializer, [NotNull] T source, [NotNull] Expression <Func <T, TProperty> > propertySelector, [NotNull] out PropertyInfo propertyInfo)
        {
            if (lambdaExpressionInitializer == null)
            {
                throw new ArgumentNullException(nameof(lambdaExpressionInitializer));
            }

            if (source == null)
            {
                throw new ArgumentNullException(nameof(source));
            }

            if (propertySelector == null)
            {
                throw new ArgumentNullException(nameof(propertySelector));
            }

            return(lambdaExpressionInitializer.Initialize(source, propertySelector, out propertyInfo));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ParserContext"/> class.
        /// </summary>
        /// <param name="query">The query to parse.</param>
        /// <param name="configuration">An implementation of the <see cref="IQueryfyConfiguration"/> interface.</param>
        /// <param name="queryficationEngine">An implementation of the <see cref="IQueryficationEngine"/> interface.</param>
        /// <param name="valueProcessorFactory">An implementation of the <see cref="IValueProcessorFactory"/> interface.</param>
        /// <param name="lambdaExpressionInitializer">An implementation of the <see cref="ILambdaExpressionInitializer"/> interface.</param>
        /// <param name="instanceFactory">An implementation of the <see cref="IInstanceFactory"/> interface.</param>
        /// <exception cref="ArgumentNullException">The value of '<paramref name="query"/>', '<paramref name="configuration"/>', '<paramref name="queryficationEngine"/>', '<paramref name="valueProcessorFactory"/>', '<paramref name="lambdaExpressionInitializer"/>' and '<paramref name="instanceFactory"/>' cannot be null. </exception>
        public ParserContext(String query, IQueryfyConfiguration configuration, IQueryficationEngine queryficationEngine, IValueProcessorFactory valueProcessorFactory, ILambdaExpressionInitializer lambdaExpressionInitializer, IInstanceFactory instanceFactory)
        {
            if (String.IsNullOrEmpty(query))
            {
                throw new ArgumentNullException(nameof(query));
            }

            if (configuration == null)
            {
                throw new ArgumentNullException(nameof(configuration));
            }

            if (queryficationEngine == null)
            {
                throw new ArgumentNullException(nameof(queryficationEngine));
            }

            if (valueProcessorFactory == null)
            {
                throw new ArgumentNullException(nameof(valueProcessorFactory));
            }

            if (lambdaExpressionInitializer == null)
            {
                throw new ArgumentNullException(nameof(lambdaExpressionInitializer));
            }

            if (instanceFactory == null)
            {
                throw new ArgumentNullException(nameof(instanceFactory));
            }

            this.queryficationDictionary     = QueryficationDictionary.FromQueryString(query, configuration);
            this.propertyParserMaps          = new ParserMapCollection();
            this.Configuration               = configuration;
            this.queryficationEngine         = queryficationEngine;
            this.InstanceFactory             = instanceFactory;
            this.ValueProcessorFactory       = valueProcessorFactory;
            this.lambdaExpressionInitializer = lambdaExpressionInitializer;
        }