Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Nathan Woulfe 447 posts 1664 karma points MVP 5x hq c-trib
    Sep 17, 2019 @ 23:24
    Nathan Woulfe
    0

    Examine service registration with Autofac

    Trying to clean up some old stuff, running into an issue with registering a service with Autofac.

    Solution has two implementations of Examine's ISimpleDataService, within which I want to use ctor injection to pass in my dependencies. We use Autofac as our container, and already do plenty of service registration etc with no issue, but am struggling with ISimpleDataService.

    Thought something like builder.RegisterType<MyService>().As<ISimpleDataService>() would do the job, but Examine blows up on startup, telling me that Examine.LuceneEngine.Providers.SimpleDataIndexer has no parameterless constructor, which is a common error when Autofac isn't configured correctly.

    Has anyone done similar? Not worried about the DI container, just interested in the general registration of the service...

Please Sign in or register to post replies

Write your reply to:

Draft