/// <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;
        }
示例#3
0
 /// <inheritdoc />
 protected 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,
                             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)
     : base(options, loggerFactory, getAll, getById, getSecondary, getRelationship, create, addToRelationship, update, setRelationship, delete,
            removeFromRelationship)
 {
 }
 /// <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)
 {
 }
示例#5
0
 protected BaseJsonApiController(
     IJsonApiOptions jsonApiOptions,
     ILoggerFactory loggerFactory,
     IGetAllService <T, TId> getAll                          = null,
     IGetByIdService <T, TId> getById                        = null,
     IGetSecondaryService <T, TId> getSecondary              = null,
     IGetRelationshipService <T, TId> getRelationship        = 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;
     _getSecondary        = getSecondary;
     _getRelationship     = getRelationship;
     _create              = create;
     _update              = update;
     _updateRelationships = updateRelationships;
     _delete              = delete;
 }