Describe the bug
I think the ctx.RootType should be the type which Resolve calls. However, it is lightweight root.
To Reproduce
namespace PureDIRootTypeTest
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Pure.DI;
using Shouldly;
internal partial class Program
{
private static void Setup() => DI.Setup()
.Bind().To(ctx => new Logger(ctx.RootType))
.Root<Parent>();
static void Main(string[] args)
{
var parent = new Program().Resolve<Parent>();
parent.Child.Logger.Type.ShouldBeOfType<Parent>(); // It is LightweightRoot264d
}
}
public class Parent
{
public Parent(Child child)
{
Child = child;
}
public Child Child { get; }
}
public class Child
{
public Child(Logger logger)
{
Logger = logger;
}
public Logger Logger { get; }
}
public class Logger
{
public Logger(Type type)
{
Type = type;
}
public Type Type { get; }
}
}
Expected behavior
type of Parent
Describe the bug
I think the ctx.RootType should be the type which
Resolvecalls. However, it is lightweight root.To Reproduce
Expected behavior
type of
Parent