private void _addService(Type interfaceType, Type implementationType, DiType diType, IReadOnlyCollection <object> args = null) { if (!interfaceType.IsAssignableFrom(implementationType)) { throw new Exception($"The type {implementationType.Name} is not subclass of {interfaceType.Name}"); } if (_typeIsRegistered(implementationType)) { throw new Exception("The type " + implementationType.Name + " is already registered."); } DiConfig config; if (args == null || args.Count == 0) { config = new DiConfig(); } else { config = new DiConfigWithArguments { PrimitiveArgumentList = args.ToList() }; } config.ImplementationType = implementationType; config.InterfaceType = interfaceType; config.Type = diType; _configs.Add(config); }
public static Sts Sts(this DiType d) { DI i = DIMgr.Instance.FindBy((int)d); if (i == null) { return(new Infrastructure.Sts()); } return(i.Status); }