This one should be clean. Ok to commit?

Also, I have a Northwind creation script for PostgreSQL that I am not
attaching because of its size. It is a completely new file that does not
touch anything else. Ok to commit?

federico

-- 
Federico Di Gregorio                         http://people.initd.org/fog
Debian GNU/Linux Developer                                [email protected]
INIT.D Developer                                           [email protected]
 Credo fermamente che da qualche parte, in una scatola ci sia un gatto
  che non è vivo ne morto. Credo anche che se i fisici non si sbrigano
  a dargli una scatoletta, ben presto sarà solo morto.
                              -- adattato da una frase di Sam Black Crow
Index: src/DbLinq/Data/Linq/DataContext.cs
===================================================================
--- src/DbLinq/Data/Linq/DataContext.cs	(revisione 1144)
+++ src/DbLinq/Data/Linq/DataContext.cs	(copia locale)
@@ -169,7 +169,7 @@
                 throw new NotImplementedException("Server name not supported.");
 
             // Assume it's a connection string...
-            IVendor ivendor = GetVendor(fileOrServerOrConnection);
+            IVendor ivendor = GetVendor(ref fileOrServerOrConnection);
 
             IDbConnection dbConnection = ivendor.CreateDbConnection(fileOrServerOrConnection);
             Init(new DatabaseContext(dbConnection), mapping, ivendor);
@@ -188,21 +188,21 @@
         [DbLinqToDo]
         public DataContext(string connectionString)
         {
-            IVendor ivendor = GetVendor(connectionString);
+            IVendor ivendor = GetVendor(ref connectionString);
 
             IDbConnection dbConnection = ivendor.CreateDbConnection(connectionString);
             Init(new DatabaseContext(dbConnection), null, ivendor);
 
         }
 
-        private IVendor GetVendor(string connectionString)
+        private IVendor GetVendor(ref string connectionString)
         {
             if (connectionString == null)
                 throw new ArgumentNullException("connectionString");
 
             Assembly assy;
             string vendorClassToLoad;
-            GetVendorInfo(connectionString, out assy, out vendorClassToLoad);
+            GetVendorInfo(ref connectionString, out assy, out vendorClassToLoad);
 
             var types =
                 from type in assy.GetTypes()
@@ -223,10 +223,10 @@
             return (IVendor) Activator.CreateInstance(types.First());
         }
 
-        private void GetVendorInfo(string connectionString, out Assembly assembly, out string typeName)
+        private void GetVendorInfo(ref string connectionString, out Assembly assembly, out string typeName)
         {
             System.Text.RegularExpressions.Regex reProvider
-                = new System.Text.RegularExpressions.Regex(@"DbLinqProvider=([\w\.]+)");
+                = new System.Text.RegularExpressions.Regex(@"DbLinqProvider=([\w\.]+);?");
 
             string assemblyFile = null;
             string vendor;
@@ -283,13 +283,13 @@
             if (databaseContext.Connection.ConnectionString == null)
                 throw new NullReferenceException();
 
+            string connectionString = databaseContext.Connection.ConnectionString;
             _VendorProvider = ObjectFactory.Get<IVendorProvider>();
             Vendor = vendor ?? 
-                (databaseContext.Connection.ConnectionString != null
-                    ? GetVendor(databaseContext.Connection.ConnectionString)
-                    : null) ??
+                (connectionString != null ? GetVendor(ref connectionString) : null) ??
                 _VendorProvider.FindVendorByProviderType(typeof(SqlClient.Sql2005Provider));
-
+            databaseContext.Connection.ConnectionString = connectionString;
+            
             DatabaseContext = databaseContext;
 
             MemberModificationHandler = ObjectFactory.Create<IMemberModificationHandler>(); // not a singleton: object is stateful
@@ -429,7 +429,6 @@
                             break;
                         default:
                             throw new ArgumentOutOfRangeException();
-                            break;
                     }
                 }
                 // TODO: handle conflicts (which can only occur when concurrency mode is implemented)
Index: src/DbLinq/Vendor/Implementation/Vendor.cs
===================================================================
--- src/DbLinq/Vendor/Implementation/Vendor.cs	(revisione 1144)
+++ src/DbLinq/Vendor/Implementation/Vendor.cs	(copia locale)
@@ -163,7 +163,7 @@
         /// </summary>
         public IDbConnection CreateDbConnection(string connectionString)
         {
-            var reConnectionType = new System.Text.RegularExpressions.Regex(@"DbLinqConnectionType=([^;]*)");
+            var reConnectionType = new System.Text.RegularExpressions.Regex(@"DbLinqConnectionType=([^;]*);?");
             string connTypeVal = null;
             if (!reConnectionType.IsMatch(connectionString))
             {

Attachment: signature.asc
Description: Questa è una parte del messaggio firmata digitalmente

Reply via email to