void GetLob(String slob) { if (!_lobs.ContainsKey(slob)) { NamedLobSystemInstanceDictionary sysInstances = ApplicationRegistry.GetLobSystemInstances(); LobSystemInstance l = sysInstances[slob]; IEnumerator it = _cfg.lobCollection.GetEnumerator(); while (it.MoveNext()) { Lob lob = (Lob)it.Current; if (lob.name.Equals(slob)) { _lobInsts.Add(slob, l); //the real lob _lobs.Add(slob, lob); //the config of lob break; } } } _lobInst = (LobSystemInstance)_lobInsts[slob]; _lob = (Lob)_lobs[slob]; if (_lobInst == null) { throw new Exception(slob + " does not exist in this service provider, check the name to make sure it's correct."); } if (_lob == null) { throw new Exception(slob + " is not found in bdc.xml"); } return; }
static void WriteConfig(String pwd) { System.Xml.Serialization.XmlSerializer x = new System.Xml.Serialization.XmlSerializer(typeof(BdcConfig)); BdcConfig cfg = new BdcConfig(); cfg.ssp = "SharedService1"; Lob lob = new Lob(); Entity entity = new Entity(); entity.listUrl = "http://abc.com"; entity.name = "Product"; Action action = new Action(); action.url = "http://bbd"; action.name = "view"; entity.actionCollection.Add(action); lob.entityCollection.Add(entity); cfg.lobCollection.Add(lob); XmlTextWriter writer = new XmlTextWriter(pwd + "bdc.xml", Encoding.UTF8); x.Serialize(writer, cfg); writer.Close(); }