Exemple #1
0
        protected BaseJsonApiController(
            IJsonApiOptions jsonApiOptions,
            ILoggerFactory loggerFactory,
            IGetAllService <T, TId> getAll   = null,
            IGetByIdService <T, TId> getById = null,
            IGetRelationshipService <T, TId> getRelationship   = null,
            IGetRelationshipsService <T, TId> getRelationships = null,
            ICreateService <T, TId> create = null,
            IUpdateService <T, TId> update = null,
            IUpdateRelationshipService <T, TId> updateRelationships = null,
            IDeleteService <T, TId> delete = null)
        {
            _jsonApiOptions      = jsonApiOptions;
            _logger              = loggerFactory.CreateLogger <BaseJsonApiController <T, TId> >();
            _getAll              = getAll;
            _getById             = getById;
            _getRelationship     = getRelationship;
            _getRelationships    = getRelationships;
            _create              = create;
            _update              = update;
            _updateRelationships = updateRelationships;
            _delete              = delete;

            _logger.LogTrace("Executing constructor.");
        }
        /// <summary>
        /// Creates an instance from separate services for the various individual read and write methods.
        /// </summary>
        protected BaseJsonApiController(
            IJsonApiOptions options,
            ILoggerFactory loggerFactory,
            IGetAllService <TResource, TId> getAll                                 = null,
            IGetByIdService <TResource, TId> getById                               = null,
            IGetSecondaryService <TResource, TId> getSecondary                     = null,
            IGetRelationshipService <TResource, TId> getRelationship               = null,
            ICreateService <TResource, TId> create                                 = null,
            IAddToRelationshipService <TResource, TId> addToRelationship           = null,
            IUpdateService <TResource, TId> update                                 = null,
            ISetRelationshipService <TResource, TId> setRelationship               = null,
            IDeleteService <TResource, TId> delete                                 = null,
            IRemoveFromRelationshipService <TResource, TId> removeFromRelationship = null)
        {
            ArgumentGuard.NotNull(options, nameof(options));
            ArgumentGuard.NotNull(loggerFactory, nameof(loggerFactory));

            _options                = options;
            _traceWriter            = new TraceLogWriter <BaseJsonApiController <TResource, TId> >(loggerFactory);
            _getAll                 = getAll;
            _getById                = getById;
            _getSecondary           = getSecondary;
            _getRelationship        = getRelationship;
            _create                 = create;
            _addToRelationship      = addToRelationship;
            _update                 = update;
            _setRelationship        = setRelationship;
            _delete                 = delete;
            _removeFromRelationship = removeFromRelationship;
        }
        /// <summary>
        /// Creates an instance from separate services for the various individual read and write methods.
        /// </summary>
        protected BaseJsonApiController(
            IJsonApiOptions options,
            ILoggerFactory loggerFactory,
            IGetAllService <TResource, TId> getAll                          = null,
            IGetByIdService <TResource, TId> getById                        = null,
            IGetSecondaryService <TResource, TId> getSecondary              = null,
            IGetRelationshipService <TResource, TId> getRelationship        = null,
            ICreateService <TResource, TId> create                          = null,
            IUpdateService <TResource, TId> update                          = null,
            IUpdateRelationshipService <TResource, TId> updateRelationships = null,
            IDeleteService <TResource, TId> delete                          = null)
        {
            if (loggerFactory == null)
            {
                throw new ArgumentNullException(nameof(loggerFactory));
            }

            _options             = options ?? throw new ArgumentNullException(nameof(options));
            _traceWriter         = new TraceLogWriter <BaseJsonApiController <TResource, TId> >(loggerFactory);
            _getAll              = getAll;
            _getById             = getById;
            _getSecondary        = getSecondary;
            _getRelationship     = getRelationship;
            _create              = create;
            _update              = update;
            _updateRelationships = updateRelationships;
            _delete              = delete;
        }
 public GetWithRelationshipsJsonApiController(
     IJsonApiContext jsonApiContext,
     IResourceQueryService <T, TId> queryService = null)
     : base(jsonApiContext, queryService)
 {
     _getRelationship  = queryService;
     _getRelationships = queryService;
 }
 public GetWithRelationshipsJsonApiController(
     IJsonApiContext jsonApiContext,
     IResourceService <T, TId> resourceService)
     : base(jsonApiContext, resourceService)
 {
     _getRelationship  = resourceService;
     _getRelationships = resourceService;
 }
 public FullBaseJsonApiController(
     IJsonApiContext jsonApiContext,
     IResourceService <T, TId> resourceService)
     : base(jsonApiContext, resourceService)
 {
     _getRelationship     = resourceService;
     _getRelationships    = resourceService;
     _updateRelationships = resourceService;
 }
 public ResourceController(IJsonApiOptions options, ILoggerFactory loggerFactory, IGetAllService <Resource, int> getAll = null,
                           IGetByIdService <Resource, int> getById = null, IGetSecondaryService <Resource, int> getSecondary                   = null,
                           IGetRelationshipService <Resource, int> getRelationship               = null, ICreateService <Resource, int> create = null,
                           IAddToRelationshipService <Resource, int> addToRelationship           = null, IUpdateService <Resource, int> update = null,
                           ISetRelationshipService <Resource, int> setRelationship               = null, IDeleteService <Resource, int> delete = null,
                           IRemoveFromRelationshipService <Resource, int> removeFromRelationship = null)
     : base(options, loggerFactory, getAll, getById, getSecondary, getRelationship, create, addToRelationship, update, setRelationship, delete,
            removeFromRelationship)
 {
 }
 public FullBaseJsonApiController(
     IJsonApiContext jsonApiContext,
     IResourceQueryService <T, TId> queryService = null,
     IResourceCmdService <T, TId> cmdService     = null)
     : base(jsonApiContext, queryService, cmdService)
 {
     _getRelationship     = queryService;
     _getRelationships    = queryService;
     _updateRelationships = cmdService;
 }
 public GetWithRelationshipsJsonApiController(
     IJsonApiContext jsonApiContext,
     IGetAllService <T, TId> getAll   = null,
     IGetByIdService <T, TId> getById = null,
     IGetRelationshipService <T, TId> getRelationship   = null,
     IGetRelationshipsService <T, TId> getRelationships = null
     ) : base(jsonApiContext, getAll, getById)
 {
     _getRelationship  = getRelationship;
     _getRelationships = getRelationships;
 }
 /// <inheritdoc />
 public GetOpProcessor(
     IGetAllService <T, int> getAll,
     IGetByIdService <T, int> getById,
     IGetRelationshipService <T, int> getRelationship,
     IJsonApiDeSerializer deSerializer,
     IDocumentBuilder documentBuilder,
     IContextGraph contextGraph,
     IJsonApiContext jsonApiContext
     ) : base(getAll, getById, getRelationship, deSerializer, documentBuilder, contextGraph, jsonApiContext)
 {
 }
Exemple #11
0
 public JsonApiController(
     IJsonApiContext jsonApiContext,
     IGetAllService <T, int> getAll   = null,
     IGetByIdService <T, int> getById = null,
     IGetRelationshipService <T, int> getRelationship   = null,
     IGetRelationshipsService <T, int> getRelationships = null,
     ICreateService <T, int> create = null,
     IUpdateService <T, int> update = null,
     IUpdateRelationshipService <T, int> updateRelationships = null,
     IDeleteService <T, int> delete = null
     ) : base(jsonApiContext, getAll, getById, getRelationship, getRelationships, create, update, updateRelationships, delete)
 {
 }
Exemple #12
0
 public ResourceController(
     IJsonApiOptions jsonApiOptions,
     ILoggerFactory loggerFactory,
     IGetAllService <Resource, int> getAll   = null,
     IGetByIdService <Resource, int> getById = null,
     IGetRelationshipService <Resource, int> getRelationship   = null,
     IGetRelationshipsService <Resource, int> getRelationships = null,
     ICreateService <Resource, int> create = null,
     IUpdateService <Resource, int> update = null,
     IUpdateRelationshipService <Resource, int> updateRelationships = null,
     IDeleteService <Resource, int> delete = null)
     : base(jsonApiOptions, loggerFactory, getAll, getById, getRelationship, getRelationships, create,
            update, updateRelationships, delete)
 {
 }
Exemple #13
0
 public BaseJsonApiController(
     IJsonApiOptions jsonApiOptions,
     IResourceQueryService <T, TId> queryService = null,
     IResourceCmdService <T, TId> cmdService     = null)
 {
     _jsonApiOptions      = jsonApiOptions;
     _getAll              = queryService;
     _getById             = queryService;
     _getRelationship     = queryService;
     _getRelationships    = queryService;
     _create              = cmdService;
     _update              = cmdService;
     _updateRelationships = cmdService;
     _delete              = cmdService;
 }
 /// <inheritdoc />
 public JsonApiController(
     IJsonApiOptions options,
     ILoggerFactory loggerFactory,
     IGetAllService <TResource, TId> getAll                          = null,
     IGetByIdService <TResource, TId> getById                        = null,
     IGetSecondaryService <TResource, TId> getSecondary              = null,
     IGetRelationshipService <TResource, TId> getRelationship        = null,
     ICreateService <TResource, TId> create                          = null,
     IUpdateService <TResource, TId> update                          = null,
     IUpdateRelationshipService <TResource, TId> updateRelationships = null,
     IDeleteService <TResource, TId> delete                          = null)
     : base(options, loggerFactory, getAll, getById, getSecondary, getRelationship, create, update,
            updateRelationships, delete)
 {
 }
 public FullBaseJsonApiController(
     IJsonApiContext jsonApiContext,
     IGetAllService <T, TId> getAll   = null,
     IGetByIdService <T, TId> getById = null,
     IGetRelationshipService <T, TId> getRelationship   = null,
     IGetRelationshipsService <T, TId> getRelationships = null,
     ICreateService <T, TId> create = null,
     IUpdateService <T, TId> update = null,
     IUpdateRelationshipService <T, TId> updateRelationships = null,
     IDeleteService <T, TId> delete = null
     ) : base(jsonApiContext, getAll, getById, create, update, delete)
 {
     _getRelationship     = getRelationship;
     _getRelationships    = getRelationships;
     _updateRelationships = updateRelationships;
 }
Exemple #16
0
 /// <param name="jsonApiOptions"></param>
 /// <param name="getAll"></param>
 /// <param name="getById"></param>
 /// <param name="getRelationship"></param>
 /// <param name="getRelationships"></param>
 /// <param name="create"></param>
 /// <param name="update"></param>
 /// <param name="updateRelationships"></param>
 /// <param name="delete"></param>
 public BaseJsonApiController(
     IJsonApiOptions jsonApiOptions,
     IGetAllService <T, TId> getAll   = null,
     IGetByIdService <T, TId> getById = null,
     IGetRelationshipService <T, TId> getRelationship   = null,
     IGetRelationshipsService <T, TId> getRelationships = null,
     ICreateService <T, TId> create = null,
     IUpdateService <T, TId> update = null,
     IUpdateRelationshipService <T, TId> updateRelationships = null,
     IDeleteService <T, TId> delete = null)
 {
     _jsonApiOptions      = jsonApiOptions;
     _getAll              = getAll;
     _getById             = getById;
     _getRelationship     = getRelationship;
     _getRelationships    = getRelationships;
     _create              = create;
     _update              = update;
     _updateRelationships = updateRelationships;
     _delete              = delete;
 }
Exemple #17
0
        public BaseJsonApiController(
            IJsonApiOptions jsonApiOptions,
            IResourceService <T, TId> resourceService,
            ILoggerFactory loggerFactory)
        {
            if (loggerFactory != null)
            {
                _logger = loggerFactory.CreateLogger <BaseJsonApiController <T, TId> >();
            }
            else
            {
                _logger = new Logger <BaseJsonApiController <T, TId> >(new LoggerFactory());
            }

            _jsonApiOptions      = jsonApiOptions;
            _getAll              = resourceService;
            _getById             = resourceService;
            _getRelationship     = resourceService;
            _getRelationships    = resourceService;
            _create              = resourceService;
            _update              = resourceService;
            _updateRelationships = resourceService;
            _delete              = resourceService;
        }