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