Fix WithParameter does not work with property or field injection
Subject:
public class Hoge
{
[Inject]
private readonly int _hoge;
}
protected override void Configure(IContainerBuilder builder)
{
builder.Register<Hoge>(Lifetime.Singleton)
.WithParameter(1234);
}
Expected behaviour:
- Builder should not throw any Exception
Actual result:
- VContainerException: No such registration of type: System.Int32
This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.
🔍 Inspect: https://vercel.com/hadashia/vcontainer/C3aFDgsTsSUnods1ZthT6hG7Qcdr
✅ Preview: https://vcontainer-git-fork-piti6-mkim-fix-parameter-does-no-1cb9c2.vercel.app
When changing the behavior of the ReferectionInjector, I found that I needed to change the CodeGen mode as well. https://github.com/hadashiA/VContainer/blob/master/VContainer/Assets/VContainer/Editor/CodeGen/InjectionILGenerator.cs#L326-L362
Let me think for a moment.
Transfer to #457