private static FieldsToSerialize CreateFieldsToSerialize(IResourceGraph resourceGraph)
        {
            var resourceDefinitionProvider = DependencyFactory.CreateResourceDefinitionProvider(resourceGraph);
            var currentRequest             = new CurrentRequest();
            var sparseFieldsService        = new SparseFieldsService(resourceGraph, currentRequest);

            return(new FieldsToSerialize(resourceGraph, sparseFieldsService, resourceDefinitionProvider));
        }
예제 #2
0
        private static FieldsToSerialize CreateFieldsToSerialize(IResourceGraph resourceGraph)
        {
            var request = new JsonApiRequest();

            var constraintProviders = new IQueryConstraintProvider[]
            {
                new SparseFieldSetQueryStringParameterReader(request, resourceGraph)
            };

            var resourceDefinitionProvider = DependencyFactory.CreateResourceDefinitionProvider(resourceGraph);

            return(new FieldsToSerialize(resourceGraph, constraintProviders, resourceDefinitionProvider));
        }
        public QueryParserBenchmarks()
        {
            IJsonApiOptions options       = new JsonApiOptions();
            IResourceGraph  resourceGraph = DependencyFactory.CreateResourceGraph();

            var currentRequest = new CurrentRequest();

            currentRequest.SetRequestResource(resourceGraph.GetResourceContext(typeof(BenchmarkResource)));

            IResourceDefinitionProvider resourceDefinitionProvider = DependencyFactory.CreateResourceDefinitionProvider(resourceGraph);

            _queryParameterDiscoveryForSort = CreateQueryParameterDiscoveryForSort(resourceGraph, currentRequest, resourceDefinitionProvider, options);
            _queryParameterDiscoveryForAll  = CreateQueryParameterDiscoveryForAll(resourceGraph, currentRequest, resourceDefinitionProvider, options);
        }