unitycontainer / configuration

Unity.Configuration package
Apache License 2.0
13 stars 13 forks source link

Breaking change #23

Closed MrSkiv closed 4 years ago

MrSkiv commented 5 years ago

When in config file is defined type with multiple methods - only first is executed. Till version 5.8 everything worked ok, after 5.9 - only first. Same is 5.10 and 5.11. Example bellow.

class Program
{
    static void Main(string[] args)
    {
        IUnityContainer container = new UnityContainer();
        container.LoadConfiguration();

        var t = container.Resolve<MyClassCollection>();
        Console.WriteLine(t.MyItems.Count);

    }
}

public class MyClassCollection
{
    public IReadOnlyList<IMy> MyItems { get; set; } = new List<IMy>();

    public void Add(IMy pParam)
    {
        ((List<IMy>)MyItems).Add(pParam);
    }
}

public class MyClass : IMy
{

}

public interface IMy
{

}

Config is:

Sample project: UnityBug.zip

MrSkiv commented 4 years ago

Is someone reading these issues or project is abandoned?

ENikS commented 4 years ago

I am reading it but unable to work on the project at the moment

ENikS commented 4 years ago

The container does not support calling the same method multiple times. It only calls distinct methods. You would have either create multiple methods or change method's signature to accommodate every case.