Giter Site home page Giter Site logo

ninject.extensions.contextpreservation's Introduction

Ninject.Extensions.ContextPreservation

Build status codecov NuGet Version NuGet Downloads

This Ninject extension enables one to preserve contextual information pertaining to earlier requests that indirectly led to a given request in order to fulfil the following key objectives:

  • Enable more detailed tracing of Resolution failures
  • Enable richer Contextual Binding (e.g. being able to define rules looking further up the resolution hierarchy such as when a Factory enters the picture, including ones generated by Ninject.Extensions.Factory)
  • Enable richer Scoping rules (e.g. being able to use Ninject.Extensions.NamedScope's InCallScope for objects created by a Factory)

Documentation

https://github.com/ninject/Ninject.Extensions.ContextPreservation/wiki

ninject.extensions.contextpreservation's People

Contributors

bartelink avatar iappert avatar idavis avatar imaginarydevelopment avatar remogloor avatar scott-xu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ninject.extensions.contextpreservation's Issues

ContextPreservationExtensionMethods.GetServiceType throws when resolving generic type (not generic type definition)

See src/Ninject.Extensions.ContextPreservation/ContextPreservationExtensionMethods.cs:

The code is:

private static Type GetServiceType(Type service, IContext context)
{
    if (service.IsGenericType)
    {
        service = service.MakeGenericType(context.GenericArguments);
    }

    return service;
} 

I use it like that:

return (IInterceptor)context.ContextPreservingGet(interceptorType, loggerArgument, targetArgument);

And i get the following error:

bei System.RuntimeType.MakeGenericType(Type[] instantiation)
System.ArgumentNullException
Der Wert darf nicht NULL sein.
Parametername: instantiation

I believe the check should actually be if(service.IsGenericTypeDefinition)

In the meantime i'm using

return (IInterceptor)context.GetContextPreservingResolutionRoot().Get(interceptorType, loggerArgument, targetArgument);

which circumvent's the call to service.MakeGenericType(...)

Conflicting NuGet package dependencies

Using VS2019. Cloned the most current version of the master branch. Attempted to restore NuGet packages. Error "NU1605 Detected package downgrade: Castle.Core from 4.2.0 to 4.1.1."
Looking at the solution's dependencies, it appears the Ninject.Extensions.Factory package (v3.3.2) requires Castle.Core >= 4.2.0, but only the 4.1.1 version is referenced.
I can change the reference in my cloned copy to a more recent version of Castle.Core, but the project files on the master branch probably need to be changed to reflect the actual required packages. Not sure how your build tags on the code are showing that it builds correctly since it can't resolve the referenced nuget packages due to the conflict? Perhaps something to look into with the build pipeline. I realize this project hasn't been updated in a while.

Support Ninject 3.3

Hi,
We have an internal library using Ninject that targets .NETStandard 2.0 and only Ninject 3.3 supports this. Can you please release a version of this library that includes 3.3 as a dependency? Currently the .nuspec file specifies Ninject (>= 3.2.0 && < 3.3.0).

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.