protected ILastMonthCompanies this[string key] { get { if (InterfaceInstanceList.ContainsKey(key)) { return(InterfaceInstanceList[key]); } else { List <InterfaceInstance> interfaces = InterfaceInstanceOperator.Instance.LoadListByName("ILastMonthCompanies"); InterfaceInstance newInstance = interfaces.Find(I => I.InterfaceInstanceName == key); if (newInstance != null) { ILastMonthCompanies _interface = LastMonthCompaniesBuilder.Instance.DoBuild(newInstance.Reference); if (_interface != null) { AddHandle(newInstance.InterfaceInstanceName, _interface); return(_interface); } } } return(DefaultHandle); } }
protected void AddHandle(string InstanceName, ILastMonthCompanies interfaceInstance) { if (!InterfaceInstanceList.ContainsKey(InstanceName)) { InterfaceInstanceList.Add(InstanceName, interfaceInstance); } else { InterfaceInstanceList[InstanceName] = interfaceInstance; } }
public LastMonthCompaniesEngine() { //注册 AddHandle("*", new DefaultLastMonthCompanies()); AddHandle("Directly", new LastMonthCompanies_Directly()); List <InterfaceInstance> interfaces = InterfaceInstanceOperator.Instance.LoadListByName("ILastMonthCompanies"); //注册扩展服务 foreach (InterfaceInstance info in interfaces) { //根据InterfaceInstanceName,实现不同的处理方法 ILastMonthCompanies _interface = LastMonthCompaniesBuilder.Instance.DoBuild(info.Reference); if (_interface != null) { AddHandle(info.InterfaceInstanceName, _interface); } } }