JasperFx / lamar

Fast Inversion of Control Tool and Successor to StructureMap
https://jasperfx.github.io/lamar
MIT License
566 stars 117 forks source link

AddAllTypesOf<T> not registering as List<T> #207

Closed Nick-Case closed 4 years ago

Nick-Case commented 4 years ago

Bit of a strange one as I've used this successfully for years in StructureMap, but moving over to Lamar, I'm having issues with scan.AddAllTypesOf(), here's some sample code below:

 public interface ITest
    {
        string Name { get; }
    }

    public class A : ITest
    {
        public string Name => "A";
    }

    public class B : ITest
    {
        public string Name => "B";
    }

 public class Registry : ServiceRegistry
    {
        public Registry()
        {
            Scan(scan =>
            {
                scan.TheCallingAssembly();
                scan.WithDefaultConventions();

                scan.AddAllTypesOf<ITest>();
            });
        }
    }

When I add this to a container, and do container.WhatDoIHave() it shows:

ITest | assembly | Transient | new A();
                   Transient | new B();                      

What I would expect to see (and do see in some other interfaces) is:

List<ITest> | System.Collections.Generic | Transient | List all of ITest

Is there something I'm doing wrong now, or is this an issue, as obviously when I'm asking for a: List in a ctor, it's failing to resolve?

jeremydmiller commented 4 years ago

The magic List<T> registration wouldn't exist until you've resolved List<T> for the first time. I'm not aware of any issues with the enumerable resolution and this is pretty heavily tested. What's actually not working at runtime?

jeremydmiller commented 4 years ago

The magic List<T> registration wouldn't exist until you've resolved List<T> for the first time. I'm not aware of any issues with the enumerable resolution and this is pretty heavily tested. What's actually not working at runtime?

jeremydmiller commented 4 years ago

No recent activity, and I don't think this is a real issue. Could use some docs I suppose.