public JsonApiResourceService(
            IResourceRepository <TResource, TId> repository,
            IQueryLayerComposer queryLayerComposer,
            IPaginationContext paginationContext,
            IJsonApiOptions options,
            ILoggerFactory loggerFactory,
            IJsonApiRequest request,
            IResourceChangeTracker <TResource> resourceChangeTracker,
            IResourceFactory resourceFactory,
            IResourceHookExecutor hookExecutor = null)
        {
            if (loggerFactory == null)
            {
                throw new ArgumentNullException(nameof(loggerFactory));
            }

            _repository            = repository ?? throw new ArgumentNullException(nameof(repository));
            _queryLayerComposer    = queryLayerComposer ?? throw new ArgumentNullException(nameof(queryLayerComposer));
            _paginationContext     = paginationContext ?? throw new ArgumentNullException(nameof(paginationContext));
            _options               = options ?? throw new ArgumentNullException(nameof(options));
            _traceWriter           = new TraceLogWriter <JsonApiResourceService <TResource, TId> >(loggerFactory);
            _request               = request ?? throw new ArgumentNullException(nameof(request));
            _resourceChangeTracker = resourceChangeTracker ?? throw new ArgumentNullException(nameof(resourceChangeTracker));
            _resourceFactory       = resourceFactory ?? throw new ArgumentNullException(nameof(resourceFactory));
            _hookExecutor          = hookExecutor;
        }
Esempio n. 2
0
 public DefaultResourceService(
     IFieldsToSerialize fieldsToSerialize,
     IEnumerable <IQueryParameterService> queryParameters,
     IJsonApiOptions options,
     ILoggerFactory loggerFactory,
     IResourceRepository <TResource, TId> repository,
     IResourceContextProvider provider,
     IResourceChangeTracker <TResource> resourceChangeTracker,
     IResourceFactory resourceFactory,
     IResourceHookExecutor hookExecutor = null)
 {
     _fieldsToSerialize   = fieldsToSerialize;
     _includeService      = queryParameters.FirstOrDefault <IIncludeService>();
     _sparseFieldsService = queryParameters.FirstOrDefault <ISparseFieldsService>();
     _pageService         = queryParameters.FirstOrDefault <IPageService>();
     _sortService         = queryParameters.FirstOrDefault <ISortService>();
     _filterService       = queryParameters.FirstOrDefault <IFilterService>();
     _options             = options;
     _logger                 = loggerFactory.CreateLogger <DefaultResourceService <TResource, TId> >();
     _repository             = repository;
     _resourceChangeTracker  = resourceChangeTracker;
     _resourceFactory        = resourceFactory;
     _hookExecutor           = hookExecutor;
     _currentRequestResource = provider.GetResourceContext <TResource>();
 }
Esempio n. 3
0
        public ResourceHookExecutorFacade(IResourceHookExecutor resourceHookExecutor, IResourceFactory resourceFactory)
        {
            ArgumentGuard.NotNull(resourceHookExecutor, nameof(resourceHookExecutor));
            ArgumentGuard.NotNull(resourceFactory, nameof(resourceFactory));

            _resourceHookExecutor = resourceHookExecutor;
            _resourceFactory      = resourceFactory;
        }
 public EntityResourceService(
     IJsonApiContext jsonApiContext,
     IEntityRepository <TResource> entityRepository,
     ILoggerFactory loggerFactory       = null,
     IResourceHookExecutor hookExecutor = null) :
     base(jsonApiContext, entityRepository, loggerFactory, hookExecutor)
 {
 }
 public TestModelService(IEnumerable <IQueryParameterService> queryParameters,
                         IJsonApiOptions options,
                         IResourceRepository <TestModel, int> repository,
                         IResourceContextProvider provider,
                         IResourceHookExecutor hookExecutor = null,
                         ILoggerFactory loggerFactory       = null)
     : base(queryParameters, options, repository, provider, hookExecutor, loggerFactory)
 {
 }
Esempio n. 6
0
 public void Deconstruct(out Mock <IEnumerable <IQueryConstraintProvider> > constraintsMock, out Mock <ITargetedFields> ufMock,
                         out IResourceHookExecutor hookExecutor, out Mock <IResourceHookContainer <TPrimary> > primaryResource,
                         out Mock <IResourceHookContainer <TSecondary> > secondaryResource)
 {
     constraintsMock   = ConstraintsMock;
     ufMock            = TargetedFieldsMock;
     hookExecutor      = HookExecutor;
     primaryResource   = PrimaryResourceContainerMock;
     secondaryResource = SecondaryResourceContainerMock;
 }
Esempio n. 7
0
 public TestObjectsB(Mock <IEnumerable <IQueryConstraintProvider> > constraintsMock, Mock <ITargetedFields> targetedFieldsMock,
                     IResourceHookExecutor hookExecutor, Mock <IResourceHookContainer <TPrimary> > primaryResourceContainerMock,
                     Mock <IResourceHookContainer <TSecondary> > secondaryResourceContainerMock)
 {
     ConstraintsMock                = constraintsMock;
     TargetedFieldsMock             = targetedFieldsMock;
     HookExecutor                   = hookExecutor;
     PrimaryResourceContainerMock   = primaryResourceContainerMock;
     SecondaryResourceContainerMock = secondaryResourceContainerMock;
 }
Esempio n. 8
0
 public CustomArticleService(
     IEnumerable <IQueryParameterService> queryParameters,
     IJsonApiOptions options,
     ILoggerFactory loggerFactory,
     IResourceRepository <Article, int> repository,
     IResourceContextProvider provider,
     IResourceHookExecutor hookExecutor = null)
     : base(queryParameters, options, loggerFactory, repository, provider, hookExecutor)
 {
 }
Esempio n. 9
0
 public TestObjectsC(Mock <IEnumerable <IQueryConstraintProvider> > constraintsMock, IResourceHookExecutor hookExecutor,
                     Mock <IResourceHookContainer <TPrimary> > primaryResourceContainerMock,
                     Mock <IResourceHookContainer <TFirstSecondary> > firstSecondaryResourceContainerMock,
                     Mock <IResourceHookContainer <TSecondSecondary> > secondSecondaryResourceContainerMock)
 {
     ConstraintsMock = constraintsMock;
     HookExecutor    = hookExecutor;
     PrimaryResourceContainerMock         = primaryResourceContainerMock;
     FirstSecondaryResourceContainerMock  = firstSecondaryResourceContainerMock;
     SecondSecondaryResourceContainerMock = secondSecondaryResourceContainerMock;
 }
 public CustomArticleService(
     IResourceRepository <Article> repository,
     IQueryLayerComposer queryLayerComposer,
     IPaginationContext paginationContext,
     IJsonApiOptions options,
     ILoggerFactory loggerFactory,
     IJsonApiRequest request,
     IResourceChangeTracker <Article> resourceChangeTracker,
     IResourceFactory resourceFactory,
     IResourceHookExecutor hookExecutor = null)
     : base(repository, queryLayerComposer, paginationContext, options, loggerFactory, request,
            resourceChangeTracker, resourceFactory, hookExecutor)
 {
 }
Esempio n. 11
0
 public TestModelService(
     IResourceRepository <TestModel> repository,
     IQueryLayerComposer queryLayerComposer,
     IPaginationContext paginationContext,
     IJsonApiOptions options,
     ILoggerFactory loggerFactory,
     ICurrentRequest currentRequest,
     IResourceChangeTracker <TestModel> resourceChangeTracker,
     IResourceFactory resourceFactory,
     IResourceHookExecutor hookExecutor = null)
     : base(repository, queryLayerComposer, paginationContext, options, loggerFactory, currentRequest,
            resourceChangeTracker, resourceFactory, hookExecutor)
 {
 }
 public JsonApiResourceService(
     IResourceRepository <TResource, TId> repository,
     IQueryLayerComposer queryLayerComposer,
     IPaginationContext paginationContext,
     IJsonApiOptions options,
     ILoggerFactory loggerFactory,
     ICurrentRequest currentRequest,
     IResourceChangeTracker <TResource> resourceChangeTracker,
     IResourceFactory resourceFactory,
     IResourceHookExecutor hookExecutor = null)
 {
     _repository            = repository;
     _queryLayerComposer    = queryLayerComposer;
     _paginationContext     = paginationContext;
     _options               = options;
     _currentRequest        = currentRequest;
     _logger                = loggerFactory.CreateLogger <JsonApiResourceService <TResource, TId> >();
     _resourceChangeTracker = resourceChangeTracker;
     _resourceFactory       = resourceFactory;
     _hookExecutor          = hookExecutor;
 }
Esempio n. 13
0
 public ResourceHookExecutorFacade(IResourceHookExecutor resourceHookExecutor, IResourceFactory resourceFactory)
 {
     _resourceHookExecutor =
         resourceHookExecutor ?? throw new ArgumentNullException(nameof(resourceHookExecutor));
     _resourceFactory = resourceFactory ?? throw new ArgumentNullException(nameof(resourceFactory));
 }
Esempio n. 14
0
 public void Deconstruct(out Mock <IEnumerable <IQueryConstraintProvider> > constraintsMock, out IResourceHookExecutor hookExecutor,
                         out Mock <IResourceHookContainer <TPrimary> > primaryResourceContainerMock,
                         out Mock <IResourceHookContainer <TFirstSecondary> > firstSecondaryResourceContainerMock,
                         out Mock <IResourceHookContainer <TSecondSecondary> > secondSecondaryResourceContainerMock)
 {
     constraintsMock = ConstraintsMock;
     hookExecutor    = HookExecutor;
     primaryResourceContainerMock         = PrimaryResourceContainerMock;
     firstSecondaryResourceContainerMock  = FirstSecondaryResourceContainerMock;
     secondSecondaryResourceContainerMock = SecondSecondaryResourceContainerMock;
 }
Esempio n. 15
0
 public void Deconstruct(out IResourceHookExecutor hookExecutor, out Mock <IResourceHookContainer <TPrimary> > primaryResourceContainerMock)
 {
     hookExecutor = HookExecutor;
     primaryResourceContainerMock = PrimaryResourceContainerMock;
 }
Esempio n. 16
0
 public TestObjectsA(IResourceHookExecutor hookExecutor, Mock <IResourceHookContainer <TPrimary> > primaryResourceContainerMock)
 {
     HookExecutor = hookExecutor;
     PrimaryResourceContainerMock = primaryResourceContainerMock;
 }