Example #1
0
 public OrderByPropertyMappingValue(
     IEnumerable <string> destinationProperties,
     bool reverse = false
     )
 {
     DestinationProperties = NullX.Throw(destinationProperties, nameof(destinationProperties));
     Reverse = reverse;
 }
 public PlayerCollectionsController(
     IMapper mapper,
     IPlayersRepository playersRepository,
     IOrderByPropertyMappingService <PlayerDto, Player> orderByPropertyMappingService,
     IEntityUpdater <Player, Guid> entityUpdater
     ) : base(mapper, playersRepository, entityUpdater, orderByPropertyMappingService)
 {
     _playersRepository = NullX.Throw(playersRepository, nameof(playersRepository));
 }
        /// <summary>
        ///
        /// </summary>
        /// <param name="mapper">AutoMapper instance</param>
        /// <param name="resourceRepository">Resource repository instance</param>
        /// <param name="entityUpdater">Entity ID Updater required for Upserts </param>
        /// <param name="orderByPropertyMappingService">Optional services to map resource property names to entity property names</param>
        /// <param name="config">Optional configuration overides.</param>
        /// <param name="logger">Optional logger.</param>
        protected ResourceControllerBase([NotNull] IMapper mapper,
                                         [NotNull] IResourceRepository <TEntity, TId> resourceRepository,
                                         IEntityUpdater <TEntity, TId> entityUpdater,
                                         IOrderByPropertyMappingService <TDto, TEntity> orderByPropertyMappingService = null,
                                         Action <HateoasConfig> config = null,
                                         ILogger <ResourceControllerBase <TDto, TEntity, TId> > logger = null)
        {
            Logger = logger;
            ConfigureHateoas(config);

            Mapper = NullX.Throw(mapper, nameof(mapper));
            _restResourceRepository        = NullX.Throw(resourceRepository, nameof(resourceRepository));
            _orderByPropertyMappingService = NullX.Throw(orderByPropertyMappingService, nameof(orderByPropertyMappingService));
            _entityUpdater = NullX.Throw(entityUpdater, nameof(entityUpdater));
        }
        public IActionResult SetupInvalidModelStateResponse(ActionContext context)
        {
            context = NullX.Throw(context, nameof(context));

            var problemDetails = new ValidationProblemDetails(context.ModelState)
            {
                Title    = _title,
                Status   = _statusCode,
                Detail   = _details,
                Instance = context.HttpContext.Request.Path,
                Type     = _problemType
            };

            problemDetails.Extensions.Add(_traceIdKey, context.HttpContext.TraceIdentifier);

            return(new UnprocessableEntityObjectResult(problemDetails)
            {
                ContentTypes = { _contentType }
            });
        }
Example #5
0
 public PropertyMapping(IDictionary <string, OrderByPropertyMappingValue> mappingDictionary)
 {
     MappingDictionary = NullX.Throw(mappingDictionary, nameof(mappingDictionary));
 }