コード例 #1
0
        /// <summary>
        /// Get the XML-element for the connection string.
        /// </summary>
        /// <param name="connectionString">The connection string with its parameters.</param>
        /// <returns>The element for XML.</returns>
        private XElement GetConnectionStringElement(ConnectionStringEntity connectionString)
        {
            XElement connectionStringElement = new XElement("ConnectionString");

            connectionStringElement.SetAttributeValue("Key", connectionString.Key);
            connectionStringElement.SetAttributeValue("Value", connectionString.ConnectionString);

            return(connectionStringElement);
        }
コード例 #2
0
        /// <summary>
        /// Craete a basic XML-file.
        /// </summary>
        private void CreateBasicXmlFile()
        {
            ConnectionStringEntity connectionString = new ConnectionStringEntity(DefaultConnectionStringValue);

            XElement xml = new XElement("ConnectionStrings",
                                        GetConnectionStringElement(connectionString));

            _xmlDocument.Add(xml);
            _xmlDocument.Save(_filename);
        }