Author: mhabersack
Date: 2007-04-30 07:02:24 -0400 (Mon, 30 Apr 2007)
New Revision: 76486

Modified:
   trunk/mcs/class/System.Data/System.Data.Common/ChangeLog
   trunk/mcs/class/System.Data/System.Data.Common/DbProviderFactories.cs
   trunk/mcs/class/System.Web/System.Web.Compilation/ChangeLog
   
trunk/mcs/class/System.Web/System.Web.Compilation/ConnectionStringsExpressionBuilder.cs
   trunk/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog
   trunk/mcs/class/System.Web/System.Web.UI.WebControls/SqlDataSource.cs
Log:
2007-04-30  Marek Habersack  <[EMAIL PROTECTED]>

        * ConnectionStringsExpressionBuilder.cs: support expressions with
        suffixes .ProviderName and .ConnectionString (case-insensitie) and
        generate a call to GetConnectionStringProviderName in the former
        case. Fixes bug #81490

2007-04-30  Marek Habersack  <[EMAIL PROTECTED]>

        * SqlDataSource.cs: do not catch the exception if ProviderName is
        not null or empty (as per docs and what MS.NET does).

2007-04-30  Marek Habersack  <[EMAIL PROTECTED]>

        * DbProviderFactories.cs: throw the same exception MS.NET does.


Modified: trunk/mcs/class/System.Data/System.Data.Common/ChangeLog
===================================================================
--- trunk/mcs/class/System.Data/System.Data.Common/ChangeLog    2007-04-30 
09:52:21 UTC (rev 76485)
+++ trunk/mcs/class/System.Data/System.Data.Common/ChangeLog    2007-04-30 
11:02:24 UTC (rev 76486)
@@ -1,3 +1,7 @@
+2007-04-30  Marek Habersack  <[EMAIL PROTECTED]>
+
+       * DbProviderFactories.cs: throw the same exception MS.NET does.
+
 2007-03-03  Gert Driesen  <[EMAIL PROTECTED]>
 
        * DbProviderFactoriesConfigurationHandler.cs: Added support for

Modified: trunk/mcs/class/System.Data/System.Data.Common/DbProviderFactories.cs
===================================================================
--- trunk/mcs/class/System.Data/System.Data.Common/DbProviderFactories.cs       
2007-04-30 09:52:21 UTC (rev 76485)
+++ trunk/mcs/class/System.Data/System.Data.Common/DbProviderFactories.cs       
2007-04-30 11:02:24 UTC (rev 76486)
@@ -66,7 +66,7 @@
                                }
                        }
 
-                       throw new ConfigurationException("DataProvider is 
missing!");
+                       throw new ConfigurationErrorsException("Failed to find 
or load the registered .Net Framework Data Provider.");
                }
 
                public static DbProviderFactory GetFactory (string 
providerInvariantName)
@@ -77,7 +77,7 @@
                                if (row != null)
                                        return GetFactory (row);
                        }
-                       throw new ConfigurationException ("DataProvider is not 
found!");
+                       throw new ConfigurationErrorsException ("Failed to find 
or load the registered .Net Framework Data Provider.");
                }
 
                public static DataTable GetFactoryClasses ()

Modified: trunk/mcs/class/System.Web/System.Web.Compilation/ChangeLog
===================================================================
--- trunk/mcs/class/System.Web/System.Web.Compilation/ChangeLog 2007-04-30 
09:52:21 UTC (rev 76485)
+++ trunk/mcs/class/System.Web/System.Web.Compilation/ChangeLog 2007-04-30 
11:02:24 UTC (rev 76486)
@@ -1,5 +1,10 @@
 2007-04-30  Marek Habersack  <[EMAIL PROTECTED]>
 
+       * ConnectionStringsExpressionBuilder.cs: support expressions with
+       suffixes .ProviderName and .ConnectionString (case-insensitie) and
+       generate a call to GetConnectionStringProviderName in the former
+       case. Fixes bug #81490
+
        * AppCodeCompiler.cs: support for cases when there exists a custom
        profile class but there is no App_Code directory or it's
        empty. Fixes bug #81489. 

Modified: 
trunk/mcs/class/System.Web/System.Web.Compilation/ConnectionStringsExpressionBuilder.cs
===================================================================
--- 
trunk/mcs/class/System.Web/System.Web.Compilation/ConnectionStringsExpressionBuilder.cs
     2007-04-30 09:52:21 UTC (rev 76485)
+++ 
trunk/mcs/class/System.Web/System.Web.Compilation/ConnectionStringsExpressionBuilder.cs
     2007-04-30 11:02:24 UTC (rev 76486)
@@ -54,7 +54,7 @@
                        Pair connString = parsedData as Pair;
                        return new CodeMethodInvokeExpression (
                                new CodeTypeReferenceExpression (typeof 
(ConnectionStringsExpressionBuilder)),
-                               "GetConnectionString",
+                               (bool)connString.Second ? 
"GetConnectionStringProviderName" : "GetConnectionString",
                                new CodeExpression [] {new 
CodePrimitiveExpression (connString.First)}
                        );
                }
@@ -63,7 +63,7 @@
                {
                        ConnectionStringSettings conn = 
WebConfigurationManager.ConnectionStrings [connectionStringName];
                        if (conn == null)
-                               return "";
+                               return String.Empty;
                        else
                                return conn.ConnectionString;
                }
@@ -72,14 +72,29 @@
                {
                        ConnectionStringSettings conn = 
WebConfigurationManager.ConnectionStrings [connectionStringName];
                        if (conn == null)
-                               return "";
+                               return String.Empty;
                        else
                                return conn.ProviderName;
                }
 
                public override object ParseExpression (string expression, Type 
propertyType, ExpressionBuilderContext context)
                {
-                       return new Pair (expression, GetConnectionString 
(expression));
+                       bool wantsProviderName = false;
+                       string connStringName = String.Empty;
+
+                       if (!String.IsNullOrEmpty (expression)) {
+                               int subidx = expression.Length;
+                               
+                               if (expression.EndsWith (".providername", 
StringComparison.InvariantCultureIgnoreCase)) {
+                                       wantsProviderName = true;
+                                       subidx -= 13;
+                               } else if (expression.EndsWith 
(".connectionstring", StringComparison.InvariantCultureIgnoreCase))
+                                       subidx -= 17;
+
+                               connStringName = expression.Substring (0, 
subidx);
+                       }
+                       
+                       return new Pair (connStringName, wantsProviderName);
                }
 
                public override bool SupportsEvaluate {

Modified: trunk/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog      
2007-04-30 09:52:21 UTC (rev 76485)
+++ trunk/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog      
2007-04-30 11:02:24 UTC (rev 76486)
@@ -1,3 +1,8 @@
+2007-04-30  Marek Habersack  <[EMAIL PROTECTED]>
+
+       * SqlDataSource.cs: do not catch the exception if ProviderName is
+       not null or empty (as per docs and what MS.NET does).
+
 2007-04-19 Igor Zelmanovich <[EMAIL PROTECTED]>
 
        * ChangePassword.cs:

Modified: trunk/mcs/class/System.Web/System.Web.UI.WebControls/SqlDataSource.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI.WebControls/SqlDataSource.cs       
2007-04-30 09:52:21 UTC (rev 76485)
+++ trunk/mcs/class/System.Web/System.Web.UI.WebControls/SqlDataSource.cs       
2007-04-30 11:02:24 UTC (rev 76486)
@@ -91,13 +91,9 @@
                {
                        DbProviderFactory f = null;
 
-                       if (ProviderName != null && ProviderName != "") {
-                               try {
-                                       f = 
DbProviderFactories.GetFactory(ProviderName);
-                               }
-                               catch { /* nada */ }
-                               if (f != null)
-                                       return f;
+                       if (!String.IsNullOrEmpty (ProviderName)) {
+                               f = 
DbProviderFactories.GetFactory(ProviderName);
+                               return f;
                        }
 
                        return SqlClientFactory.Instance;

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to