public ConnectionString this[ConnectionDefinition def]
 {
     get
     {
         if (!_dico.ContainsKey(def))
             _dico[def] = new ConnectionString();
         return _dico[def];
     }
     set
     {
         _dico[def] = value;
     }
 }
 public ConnectionString this[ConnectionClass clazz, ConnectionType type]
 {
     get
     {
         if (!_dico.ContainsKey(new ConnectionDefinition(clazz, type)))
             _dico[new ConnectionDefinition(clazz, type)] = new ConnectionString();
         return this[new ConnectionDefinition(clazz, type)];
     }
     set
     {
         _dico[new ConnectionDefinition(clazz, type)] = value;
     }
 }
Beispiel #3
0
        public static void Load(string filename)
        {
            var nbiFile = new XmlDocument();
            nbiFile.Load(filename);

            var dirsNode = nbiFile.GetElementsByTagName("directories")[0];
            if (dirsNode != null)
            {
                if (dirsNode.Attributes["root"] != null)
                    Directories.Root = dirsNode.Attributes["root"].Value;

                var dirNodes = nbiFile.GetElementsByTagName("directory");
                foreach (XmlNode dirNode in dirNodes)
                {
                    var key = BuildDirectoryKey(dirNode.Attributes["key"].Value);
                    Directories[key] = new Directory(Directories);

                    if (dirNode.Attributes["path"] != null)
                        Directories[key].Path = dirNode.Attributes["path"].Value;
                    if (dirNode.Attributes["file"] != null)
                        Directories[key].File = dirNode.Attributes["file"].Value;
                }
            }

            var cssNode = nbiFile.GetElementsByTagName("connectionStrings")[0];
            if (cssNode != null)
            {

                foreach (XmlNode csNode in cssNode.ChildNodes)
                {
                    var key = BuildConnectionStringKey(csNode.Name, csNode.Attributes["key"].Value);
                    ConnectionStrings[key] = new ConnectionString();

                    if (csNode.InnerXml != null)
                        ConnectionStrings[key].Value = csNode.InnerXml;
                }
            }
        }