Giter Site home page Giter Site logo

Comments (7)

thecodejunkie avatar thecodejunkie commented on May 20, 2024

@khellang is this related to the PR you sent a while back?

from nancy.bootstrappers.unity.

thoscut avatar thoscut commented on May 20, 2024

I experienced the same issue. Is there any workaround or fix in sight?

from nancy.bootstrappers.unity.

baddonkey avatar baddonkey commented on May 20, 2024

Taking the sample from http://www.stefanbader.ch/minimal-sample-self-hosted-nancy-using-owin-unity-bootstrapper-including-xunit-test , for Version 1.2. you need to slightly adapt the customized bootstrapper:

using Microsoft.Practices.Unity;
using Nancy.Bootstrappers.Unity;

namespace NancyOwinBox
{
    public class NancyOwinBoxBootstrapper : UnityNancyBootstrapper
    {
        private IUnityContainer _container;

        public NancyOwinBoxBootstrapper(IUnityContainer container)
        {
            _container = container;
+           _container.AddNewExtension<EnumerableExtension>();
        }

        protected override IUnityContainer GetApplicationContainer()
        {
            return _container;
        }
    }
}

Line:

_container.AddNewExtension<EnumerableExtension>();

is doing the trick.

from nancy.bootstrappers.unity.

khellang avatar khellang commented on May 20, 2024

@thecodejunkie Yes, I think this might be related.

As @baddonkey mentioned, it should work when calling AddNewExtension<EnumerableExtension>, but we already do that here, so it must be something else.
Could it be that we have to do the same call for the child (request) container?

@tseel @srgoapp Does it work if you call AddNewExtension<EnumerableExtension> on the request container in ConfigureRequestContainer?

from nancy.bootstrappers.unity.

khellang avatar khellang commented on May 20, 2024

Ah, now I see what's happening here. You're using a container that's not constructed by Nancy. Then you have to manually add the extension, like @baddonkey says.

from nancy.bootstrappers.unity.

khellang avatar khellang commented on May 20, 2024

I have a pending fix for this at #12. This'll make it "just work" without having to manually add the extension, even if you're using an existing, "external" bootstrapper.

from nancy.bootstrappers.unity.

khellang avatar khellang commented on May 20, 2024

The fix in #12 will go out with the 1.3 release. Hopefully next week 👍

from nancy.bootstrappers.unity.

Related Issues (3)

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.