Update Project

This commit is contained in:
2026-03-20 13:04:43 +02:00
parent 9b587e6cba
commit beae2dea89
2295 changed files with 251259 additions and 33 deletions
@@ -0,0 +1,78 @@
using System;
using System.Collections.Generic;
using System.Linq;
using ModestTree;
namespace Zenject
{
[NoReflectionBaking]
public class ConcreteBinderGeneric<TContract> : FromBinderGeneric<TContract>
{
public ConcreteBinderGeneric(
DiContainer bindContainer, BindInfo bindInfo,
BindStatement bindStatement)
: base(bindContainer, bindInfo, bindStatement)
{
ToSelf();
}
// Note that this is the default, so not necessary to call
public FromBinderGeneric<TContract> ToSelf()
{
Assert.IsEqual(BindInfo.ToChoice, ToChoices.Self);
BindInfo.RequireExplicitScope = true;
SubFinalizer = new ScopableBindingFinalizer(
BindInfo, (container, type) => new TransientProvider(
type, container, BindInfo.Arguments,
BindInfo.ContextInfo, BindInfo.ConcreteIdentifier,
BindInfo.InstantiatedCallback));
return this;
}
public FromBinderGeneric<TConcrete> To<TConcrete>()
where TConcrete : TContract
{
BindInfo.ToChoice = ToChoices.Concrete;
BindInfo.ToTypes.Clear();
BindInfo.ToTypes.Add(typeof(TConcrete));
return new FromBinderGeneric<TConcrete>(
BindContainer, BindInfo, BindStatement);
}
public FromBinderNonGeneric To(params Type[] concreteTypes)
{
return To((IEnumerable<Type>)concreteTypes);
}
public FromBinderNonGeneric To(IEnumerable<Type> concreteTypes)
{
BindingUtil.AssertIsDerivedFromTypes(
concreteTypes, BindInfo.ContractTypes, BindInfo.InvalidBindResponse);
BindInfo.ToChoice = ToChoices.Concrete;
BindInfo.ToTypes.Clear();
BindInfo.ToTypes.AddRange(concreteTypes);
return new FromBinderNonGeneric(
BindContainer, BindInfo, BindStatement);
}
#if !(UNITY_WSA && ENABLE_DOTNET)
public FromBinderNonGeneric To(
Action<ConventionSelectTypesBinder> generator)
{
var bindInfo = new ConventionBindInfo();
// Automatically filter by the given contract types
bindInfo.AddTypeFilter(
concreteType => BindInfo.ContractTypes.All(contractType => concreteType.DerivesFromOrEqual(contractType)));
generator(new ConventionSelectTypesBinder(bindInfo));
return To(bindInfo.ResolveTypes());
}
#endif
}
}
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 62ec581e8d820a74797d1dabf19d85c3
timeCreated: 1461708051
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,81 @@
using System;
using System.Collections.Generic;
using ModestTree;
namespace Zenject
{
[NoReflectionBaking]
public class ConcreteBinderNonGeneric : FromBinderNonGeneric
{
public ConcreteBinderNonGeneric(
DiContainer bindContainer, BindInfo bindInfo,
BindStatement bindStatement)
: base(bindContainer, bindInfo, bindStatement)
{
ToSelf();
}
// Note that this is the default, so not necessary to call
public FromBinderNonGeneric ToSelf()
{
Assert.IsEqual(BindInfo.ToChoice, ToChoices.Self);
BindInfo.RequireExplicitScope = true;
SubFinalizer = new ScopableBindingFinalizer(
BindInfo, (container, type) => new TransientProvider(
type, container, BindInfo.Arguments, BindInfo.ContextInfo, BindInfo.ConcreteIdentifier,
BindInfo.InstantiatedCallback));
return this;
}
public FromBinderNonGeneric To<TConcrete>()
{
return To(typeof(TConcrete));
}
public FromBinderNonGeneric To(params Type[] concreteTypes)
{
return To((IEnumerable<Type>)concreteTypes);
}
public FromBinderNonGeneric To(IEnumerable<Type> concreteTypes)
{
BindInfo.ToChoice = ToChoices.Concrete;
BindInfo.ToTypes.Clear();
BindInfo.ToTypes.AddRange(concreteTypes);
if (BindInfo.ToTypes.Count > 1 && BindInfo.ContractTypes.Count > 1)
{
// Be more lenient in this case to behave similar to convention based bindings
BindInfo.InvalidBindResponse = InvalidBindResponses.Skip;
}
else
{
BindingUtil.AssertIsDerivedFromTypes(concreteTypes, BindInfo.ContractTypes, BindInfo.InvalidBindResponse);
}
return this;
}
#if !(UNITY_WSA && ENABLE_DOTNET)
public FromBinderNonGeneric To(
Action<ConventionSelectTypesBinder> generator)
{
var bindInfo = new ConventionBindInfo();
// This is nice because it allows us to do things like Bind(all interfaces).To(specific types)
// instead of having to do Bind(all interfaces).To(specific types that inherit from one of these interfaces)
BindInfo.InvalidBindResponse = InvalidBindResponses.Skip;
generator(new ConventionSelectTypesBinder(bindInfo));
BindInfo.ToChoice = ToChoices.Concrete;
BindInfo.ToTypes.Clear();
BindInfo.ToTypes.AddRange(bindInfo.ResolveTypes());
return this;
}
#endif
}
}
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: b04935d23b1499e42a242d63a3fe248b
timeCreated: 1461708052
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,20 @@
namespace Zenject
{
[NoReflectionBaking]
public class ConcreteIdBinderGeneric<TContract> : ConcreteBinderGeneric<TContract>
{
public ConcreteIdBinderGeneric(
DiContainer bindContainer, BindInfo bindInfo,
BindStatement bindStatement)
: base(bindContainer, bindInfo, bindStatement)
{
}
public ConcreteBinderGeneric<TContract> WithId(object identifier)
{
BindInfo.Identifier = identifier;
return this;
}
}
}
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 358cdf402ef00ff40ac81f3bbe7018f0
timeCreated: 1463318690
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,20 @@
namespace Zenject
{
[NoReflectionBaking]
public class ConcreteIdBinderNonGeneric : ConcreteBinderNonGeneric
{
public ConcreteIdBinderNonGeneric(
DiContainer bindContainer, BindInfo bindInfo,
BindStatement bindStatement)
: base(bindContainer, bindInfo, bindStatement)
{
}
public ConcreteBinderNonGeneric WithId(object identifier)
{
BindInfo.Identifier = identifier;
return this;
}
}
}
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 1251d518904c9574897614d756f76756
timeCreated: 1463318690
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: