Outlook Add-in with Dependency Injection (IoC)
===

I'm writing an Outlook add-in with a separate core class library. I'm trying to use an Ioc container (Autofac), but I'm a bit lost as to how I register the Outlook session as a dependency of my services.

I'm a DI newbie.

In my ThisAddIn.cs file I instantiate a bootstrapper in my class library:

    public override void BeginInit()
    {
      _core = new AddInBootstrapper();
            
      base.BeginInit();
    }

The AddInBootStrapper.cs class is in my Core class library. Its constructor looks like so:

    public AddInBootstrapper()
        {
            var containerBuilder = new ContainerBuilder();

            containerBuilder.RegisterType<OutlookService>().As<IOutlookService>();
            containerBuilder.RegisterType<EmailPrintService>().As<IPrintService<Microsoft.Office.Interop.Outlook.MailItem>>();

            _container = containerBuilder.Build();
        }

My OutlookService class has a dependency on the Outlook session (ThisAddIn.Application.Session):

    public OutlookService(Microsoft.Office.Interop.Outlook.NameSpace session)
        {
            _session = session;
        }

I'm not sure how to wire this up in a correct manner. Do I simply pass the Session into the Bootstrapper class through its constructor then wire it up, or is there another/better way?

    _core = new AddInBootstrapper(this.Application.Session);


