mirror of
https://github.com/DCFApixels/DragonECS-AutoInjections.git
synced 2025-09-17 20:34:34 +08:00
38 lines
1.2 KiB
C#
38 lines
1.2 KiB
C#
#if DISABLE_DEBUG
|
|
#undef DEBUG
|
|
#endif
|
|
using System;
|
|
|
|
namespace DCFApixels.DragonECS
|
|
{
|
|
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property | AttributeTargets.Method, Inherited = false, AllowMultiple = false)]
|
|
public class DIAttribute : Attribute
|
|
{
|
|
public static readonly DIAttribute Dummy = new DIAttribute();
|
|
public readonly Type NotNullDummyType = null;
|
|
public readonly string NamedInjection = string.Empty;
|
|
public DIAttribute() { }
|
|
public DIAttribute(string namedInjection)
|
|
{
|
|
NamedInjection = namedInjection;
|
|
}
|
|
public DIAttribute(Type notNullDummyType)
|
|
{
|
|
NotNullDummyType = notNullDummyType;
|
|
}
|
|
public DIAttribute(string namedInjection, Type notNullDummyType)
|
|
{
|
|
NamedInjection = namedInjection;
|
|
NotNullDummyType = notNullDummyType;
|
|
}
|
|
}
|
|
|
|
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property | AttributeTargets.Method, Inherited = false, AllowMultiple = false)]
|
|
[Obsolete("Use DI attribute")]
|
|
public sealed class EcsInjectAttribute : DIAttribute
|
|
{
|
|
public EcsInjectAttribute(Type notNullDummyType = null) : base(notNullDummyType) { }
|
|
}
|
|
}
|
|
|