public class InjectContext
{
private static ContainerBuilder Container;
public static void Init()
{
InjectFrameWork();
}
public static void InjectFrameWork()
{
Container = new ContainerBuilder();
//獲框架取全部程序集
List<Assembly> assemblies = CloudUtil.GetFrameworkAssemblys();
//注入框架全部Component組件
Container.RegisterAssemblyTypes(assemblies.ToArray(), typeof(Component), true);
Container.Build(CotainerEnum.BuidlModel.OverWrite);
}
public static object Resolve(Type Type, CotainerEnum.TypeEqual TypeEqual = CotainerEnum.TypeEqual.Ref)
{
return Container.Resolve(Type, TypeEqual);
}
public static List<Type> GetRegistType(Type @Type)
{
return Container.GetRegistType(@Type);
}
}