Can I use my Ninject .NET project within Orchard CMS?

前端 未结 1 944
别跟我提以往
别跟我提以往 2021-02-10 03:40

I am creating a website using Orchard CMS and I have an external .NET project written with Ninject for dependency injection which I would like to use together with a module with

1条回答
  •  别那么骄傲
    2021-02-10 04:09

    Autofac supports registration sources (and more on registration sources here). A registration source is a service that the container will consult when trying to resolve a type. The source can respond, either with a means to build the type, or an empty list which indicates that the source is not able to provide the requested type.

    In your case, a registration source could be implemented that will try to resolve the requested type from your Ninject container.

    I'm not too familiar with Orchard but I'm guessing that it uses configuration files to configure Autofac. My suggestion is that you create a simple Autofac module that registers your registration source implementation, and that you configure Orchard to load the module from config.

    0 讨论(0)
提交回复
热议问题