给定以下接口和类,Autofac 中有没有办法
Provider<T>为所有具有 a 的类ProviderAttribute注册aT作为此类的类型(考虑注册开放泛型并使用 Autofac 解析它们MakeGenericType())- 将这些注册的提供者作为鼓声
IEnumerable<IProviderBase>注入到其他类的构造函数中
概述:
public class ProviderAttribute : Attribute { }
public interface IProviderBase
{
Type Type { get; }
}
public interface IProvider<T> : IProviderBase
{
DoSomething(T t);
}
public class Provider<T> : IProvider<T>
{
public Type Type
{
get { return typeof (T); }
}
public DoSomething(T t)
{
//...
}
}