示例#1
0
        public static void Update(XmlModel model)
        {
            XmlDocument xml = new XmlDocument();

            xml.Load(model.XmlPath);
            XmlNode nodel = xml.SelectSingleNode("/connectionStrings/add[@name='connection']");

            nodel.Attributes["connectionString"].Value = model.ConnectionString;
            nodel.Attributes["providerName"].Value     = model.ProviderName;
            xml.Save(model.XmlPath);
        }
示例#2
0
        public static XmlModel Get()
        {
            XmlModel    model = new XmlModel();
            XmlDocument xml   = new XmlDocument();

            xml.Load(model.XmlPath);
            XmlNode nodel = xml.SelectSingleNode("/connectionStrings/add[@name='connection']");

            model.ConnectionString = nodel.Attributes["connectionString"].Value;
            model.ProviderName     = nodel.Attributes["providerName"].Value;
            return(model);
        }