You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
800 B

using Microsoft.Extensions.DependencyInjection;
using WTA.Shared.DependencyInjection;
namespace WTA.Shared.Attributes;
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
public class ImplementAttribute<T> : Attribute, IImplementAttribute
{
public ImplementAttribute(ServiceLifetime lifetime = ServiceLifetime.Transient, PlatformType platformType = PlatformType.All)
{
this.ServiceType = typeof(T);
this.Lifetime = lifetime;
this.PlatformType = platformType;
}
public ServiceLifetime Lifetime { get; set; }
public PlatformType PlatformType { get; set; }
public Type ServiceType { get; }
}
public interface IImplementAttribute
{
ServiceLifetime Lifetime { get; }
PlatformType PlatformType { get; }
Type ServiceType { get; }
}