Giter Site home page Giter Site logo

mediatr.simpleinjector's People

Contributors

adaskothebeast avatar andrewpecha avatar haison8x avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

mediatr.simpleinjector's Issues

usage

Hello,

just wanted to double check this is being maintained and used in production.

Target .netstandard

Have you considered targeting .netstandard? It builds fine if I target 1.1.

Mediatr 6 compatibility

Hi,

new version of mediator 6.0.0 supports only netstandard2.0 and .net framework 4.6.1.
I can prepare pull request for that.
Please consider major bump in version as this is breaking change for people still using .net 4.6 and .netstandard1.3 compatible version.

StackOverflowException during registration

When call BuildMediator extension method like this:

container.BuildMediator(typeof(TestCommand).GetTypeInfo().Assembly);

it always call itself (version with params), and eventually raise StackOverflowException.

RegisterCollection doesn't work with generic types

Simple injector RegisterCollection doesn't register the generic types from the assemblies. So passing IPipelineBehavior assemblies won't add any registration. Maybe those binding should be removed?

Lack of license file

Hi,

could you please choose license under which you distribute that package?

Thanks

Adam

SimpleInjector activation exception

I'm getting the following error when trying to send a command with mediatr.

SimpleInjector.ActivationException: The constructor of type RequestPreProcessorBehavior<AuthenticateClientCommand, AuthenticateClientResponse> contains the parameter with name 'preProcessors' and type IEnumerable<IRequestPreProcessor<AuthenticateClientCommand>>, 
but IEnumerable<IRequestPreProcessor<AuthenticateClientCommand>> is not registered. 
For IEnumerable<IRequestPreProcessor<AuthenticateClientCommand>> to be resolved, it must be registered in the container. 
You can use one of the Container.Collection.Register overloads to register a collection of IRequestPreProcessor<AuthenticateClientCommand> types, or one of the Container.Collection.
Append overloads to append a single registration to a collection. In case you intend to resolve an empty collection of IRequestPreProcessor<AuthenticateClientCommand> elements, 
make sure you register an empty collection; Simple Injector requires a call to Container.
Collection.Register to be made, even in the absence of any instances. 
Please see https://simpleinjector.org/collections for more information about registering and resolving collections.
   at SimpleInjector.Container.ThrowParameterTypeMustBeRegistered(InjectionTargetInfo target)
   at SimpleInjector.Advanced.DefaultDependencyInjectionBehavior.GetInstanceProducer(InjectionConsumerInfo dependency, Boolean throwOnFailure)
   at SimpleInjector.ContainerOptions.GetInstanceProducerFor(InjectionConsumerInfo consumer)
   at SimpleInjector.Registration.BuildConstructorParameters(ConstructorInfo constructor)
   at SimpleInjector.Registration.BuildNewExpression()
   at SimpleInjector.Registration.BuildTransientExpression()
   at SimpleInjector.Lifestyles.TransientLifestyle.TransientRegistration.BuildExpression()
   at SimpleInjector.InstanceProducer.BuildExpressionInternal()
   at SimpleInjector.Internals.LazyEx`1.InitializeAndReturn()
   at SimpleInjector.InstanceProducer.BuildInstanceCreator()
   at SimpleInjector.InstanceProducer.BuildAndReplaceInstanceCreatorAndCreateFirstInstance()
   at SimpleInjector.InstanceProducer.GetInstance()
   at SimpleInjector.Internals.ContainerControlledCollection`1.CopyTo(TService[] array, Int32 arrayIndex)
   at System.Collections.Generic.EnumerableHelpers.ToArray[T](IEnumerable`1 source, Int32& length)
   at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
   at System.Linq.Enumerable.ReverseIterator`1.MoveNext()
   at System.Linq.Enumerable.Aggregate[TSource,TAccumulate](IEnumerable`1 source, TAccumulate seed, Func`3 func)
   at MediatR.Internal.RequestHandlerWrapperImpl`2.Handle(IRequest`1 request, CancellationToken cancellationToken, ServiceFactory serviceFactory)
   at MediatR.Mediator.Send[TResponse](IRequest`1 request, CancellationToken cancellationToken)
   at WolvePack.HowlApi.Controllers.AuthenticationController.AuthenticateClient(AuthenticateClientCommand request) in AuthenticationController.cs:line 24
   at lambda_method(Closure , Object )
   at Microsoft.Extensions.Internal.ObjectMethodExecutorAwaitable.Awaiter.GetResult()
   at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeFilterPipelineAsync>g__Awaited|19_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker)
   at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
   at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
   at CorrelationId.CorrelationIdMiddleware.Invoke(HttpContext context, ICorrelationContextFactory correlationContextFactory)
   at Microsoft.AspNetCore.Localization.RequestLocalizationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)

I'm not using any preprocessors.

Command and handler look like this:

public class AuthenticateClientCommand : IRequest<AuthenticateClientResponse> 
    {
        public Guid Id { get; set; }
        public string Secret { get; set; }
    }

    public class AuthenticateClientCommandHandler : IRequestHandler<AuthenticateClientCommand, AuthenticateClientResponse>
    {
        public async Task<AuthenticateClientResponse> Handle(AuthenticateClientCommand request, CancellationToken cancellationToken)
        {
             // code here
        }
}

Configure with:

        container.BuildMediator(<assemblies with query and commands here>);

When i take your source code and comment the following lines it works (but probably without some functionality):
container.Collection.Register(typeof(IPipelineBehavior<,>), new[]
{
typeof(RequestExceptionProcessorBehavior<,>),
typeof(RequestExceptionActionProcessorBehavior<,>),
//typeof(RequestPreProcessorBehavior<,>),
//typeof(RequestPostProcessorBehavior<,>)
});

Am I missing some configuration or is this project not fully compatible with the latest SimpleInjector? I know there are some breaking changes in 5.x.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.