List:Commits« Previous MessageNext Message »
From:rburnett Date:May 8 2007 5:45pm
Subject:Connector/NET commit: r710 - in trunk: . MySql.Web/Source
View as plain text  
Modified:
   trunk/CHANGES
   trunk/MySql.Web/Source/Install.cs
Log:
Fixed problem where ASP.Net projects would start failing after 5.1.0 was installed.  We
thing the problem was that our web providers are installed and they reference a
connection string named LocalMySqlServer but the installer was not making a default
connection string with that name.  This change fixes that.

Modified: trunk/CHANGES
===================================================================
--- trunk/CHANGES	2007-05-08 15:19:21 UTC (rev 709)
+++ trunk/CHANGES	2007-05-08 15:45:05 UTC (rev 710)
@@ -4,7 +4,9 @@
   - Fixed problem with pooling on the compact framework.  It should work now.    
   - Install now calls VS setup only when VS integration is selected. (bug #28260)
   - MySqlRoleProvider.GetRolesForUser now works correctly (bug #28251)
-    
+  - Installer now adds a default connection string to machine.config.  This will prevent
errors related to a missing 
+    connection string.  You will need to override this value in your web.config files.   

+
 Version 5.1.0 - 5/1/2007
 
   - Added Membership and Role provider contributed by Sean Wright (thanks!)

Modified: trunk/MySql.Web/Source/Install.cs
===================================================================
--- trunk/MySql.Web/Source/Install.cs	2007-05-08 15:19:21 UTC (rev 709)
+++ trunk/MySql.Web/Source/Install.cs	2007-05-08 15:45:05 UTC (rev 710)
@@ -80,6 +80,7 @@
             XmlDocument doc = new XmlDocument();
             doc.LoadXml(configXML);
 
+            AddDefaultConnectionString(doc);
             AddMembershipProvider(doc);
             AddRoleProvider(doc);
 
@@ -91,6 +92,33 @@
             writer.Close();
         }
 
+        private void AddDefaultConnectionString(XmlDocument doc)
+        {
+            // create our new node
+            XmlElement newNode = (XmlElement)doc.CreateNode(XmlNodeType.Element, "add",
"");
+
+            // add the proper attributes
+            newNode.SetAttribute("name", "LocalMySqlServer");
+            newNode.SetAttribute("connectionString", "");
+
+            XmlNodeList nodes = doc.GetElementsByTagName("connectionStrings");
+            XmlNode connectionStringList = nodes[0];
+
+            bool alreadyThere = false;
+            foreach (XmlNode node in connectionStringList.ChildNodes)
+            {
+                string nameValue = node.Attributes["name"].Value;
+                if (nameValue == "LocalMySqlServer")
+                {
+                    alreadyThere = true;
+                    break;
+                }
+            }
+
+            if (!alreadyThere)
+                connectionStringList.AppendChild(newNode);
+        }
+
         private void AddMembershipProvider(XmlDocument doc)
         {
             // create our new node
@@ -201,6 +229,7 @@
             XmlDocument doc = new XmlDocument();
             doc.LoadXml(configXML);
 
+            RemoveDefaultConnectionString(doc);
             RemoveMembershipProvider(doc);
             RemoveRoleProvider(doc);
 
@@ -212,6 +241,21 @@
             writer.Close();
         }
 
+        private void RemoveDefaultConnectionString(XmlDocument doc)
+        {
+            XmlNodeList nodes = doc.GetElementsByTagName("connectionStrings");
+            XmlNode connectionStringList = nodes[0];
+            foreach (XmlNode node in connectionStringList.ChildNodes)
+            {
+                string name = node.Attributes["name"].Value;
+                if (name == "LocalMySqlServer")
+                {
+                    connectionStringList.RemoveChild(node);
+                    break;
+                }
+            }
+        }
+
         private void RemoveMembershipProvider(XmlDocument doc)
         {
             XmlNodeList nodes = doc.GetElementsByTagName("membership");

Thread
Connector/NET commit: r710 - in trunk: . MySql.Web/Sourcerburnett8 May