Initial Commit

This commit is contained in:
2026-03-16 14:38:46 +02:00
commit b8f7327a21
2327 changed files with 253610 additions and 0 deletions
@@ -0,0 +1,37 @@
using System;
using ModestTree;
namespace Zenject
{
[NoReflectionBaking]
public class InstantiateCallbackConditionCopyNonLazyBinder : ConditionCopyNonLazyBinder
{
public InstantiateCallbackConditionCopyNonLazyBinder(BindInfo bindInfo)
: base(bindInfo)
{
}
public ConditionCopyNonLazyBinder OnInstantiated(
Action<InjectContext, object> callback)
{
BindInfo.InstantiatedCallback = callback;
return this;
}
public ConditionCopyNonLazyBinder OnInstantiated<T>(
Action<InjectContext, T> callback)
{
// Can't do this here because of factory bindings
//Assert.That(BindInfo.ContractTypes.All(x => x.DerivesFromOrEqual<T>()));
BindInfo.InstantiatedCallback = (ctx, obj) =>
{
Assert.That(obj == null || obj is T,
"Invalid generic argument to OnInstantiated! {0} must be type {1}", obj.GetType(), typeof(T));
callback(ctx, (T)obj);
};
return this;
}
}
}