protected override IStorageAttribute ParserStorage(XmlNode node) { if (null == node) { throw new ArgumentNullException("node"); } IStorageAttribute storageAttribute = GenerateStorageAttribute(node); if (string.IsNullOrEmpty(storageAttribute.Uid) && !storageAttribute.IntegratedSecurity) { throw new Exception("the database authentication mechanism is error."); } StorageCache.InsertOrUpdate(storageAttribute.Name, storageAttribute); return(storageAttribute); }
protected override IDictionary <string, IStorageAttribute> ParserStorages(XmlNode node) { if (null == node) { throw new ArgumentNullException("node"); } XmlNodeList nodes = node.SelectNodes("Storage"); if (null == nodes || 0 == nodes.Count) { throw new Exception("the Storage node is empty in the Storage..config"); } IDictionary <string, IStorageAttribute> dic = new Dictionary <string, IStorageAttribute>(); int idx = 0; foreach (XmlNode n in nodes) { IStorageAttribute storageAttribute = ParserStorage(n); if (null != storageAttribute) { dic.Add(storageAttribute.Name, storageAttribute); if (0 == idx) { //insert the default storage //the default is the first storage StorageCache.InsertOrUpdate(DefaultStorageName, storageAttribute); } idx++; } } if (0 == dic.Count) { throw new Exception("the error in the storage.config"); } return(dic); }