DragonECS-AutoInjections/src/Attributes/InjectionAttributes.cs

24 lines
839 B
C#
Raw Normal View History

2023-03-29 16:43:06 +08:00
using System;
namespace DCFApixels.DragonECS
{
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property | AttributeTargets.Method, Inherited = false, AllowMultiple = false)]
2024-11-05 12:18:55 +08:00
public class DIAttribute : Attribute
2023-03-29 16:43:06 +08:00
{
2024-11-05 12:18:55 +08:00
public static readonly DIAttribute Dummy = new DIAttribute(null);
2023-04-05 09:14:42 +08:00
public readonly Type notNullDummyType;
2024-11-05 12:18:55 +08:00
public DIAttribute(Type notNullDummyType = null)
2023-04-05 09:14:42 +08:00
{
this.notNullDummyType = notNullDummyType;
}
2023-03-29 16:43:06 +08:00
}
2024-11-05 12:18:55 +08:00
[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) { }
}
2023-03-29 16:43:06 +08:00
}