Copied to clipboard

Flag this post as spam?

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


  • Yasir Butt 159 posts 369 karma points
    Nov 24, 2020 @ 21:14
    Yasir Butt
    0

    Lightinject is not scaning assemblies

    Hi,

    I have problem with lightinject to scan my other assemblies but i have no luck

    Here is my implementation

    public  class StoreComposer : IUserComposer
    {
        public void Compose(Composition composition)
        {
            var container = composition.Concrete as LightInject.ServiceContainer;
            container.AssemblyScanner.Scan(typeof(IOrderManager).Assembly, container);
        }
    }
    

    In other project i have following code

     public class BalCompositionRoot : ICompositionRoot
    {
        public void Compose(IServiceRegistry serviceRegistry)
        {
            serviceRegistry.Register(typeof(IOrderManager), typeof(OrderManager));
    
        }
    }
    

    Can any one help me to get it work? Below screen shows the error

    enter image description here

    /Yasir

  • Yasir Butt 159 posts 369 karma points
    Nov 24, 2020 @ 21:41
    Yasir Butt
    0

    I found that how to call root composition.

    I made it work by calling another function from container instaed of Assembly scanner

    public void Compose(Composition composition)
        {
            var container = composition.Concrete as LightInject.ServiceContainer;
            container.RegisterFrom<BalCompositionRoot>();
        }
    

    it may helps other :)

Please Sign in or register to post replies

Write your reply to:

Draft