Comments inline.

On Fri, 2009-06-12 at 16:56 +0200, Federico Di Gregorio wrote:
> Index: src/DbLinq/Data/Linq/DataContext.cs
> ===================================================================
> --- src/DbLinq/Data/Linq/DataContext.cs (revisione 1141)
> +++ 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,15 @@
>              if (databaseContext.Connection.ConnectionString == null)
>                  throw new NullReferenceException();
>  
> +                       string connectionString = 
> databaseContext.Connection.ConnectionString;

The indentation is wrong here.  You might check your editor settings; it
should be expand tab, tab = 4 spaces (vim: et ts=4 sw=4).

>              _VendorProvider = ObjectFactory.Get<IVendorProvider>();
>              Vendor = vendor ?? 
>                  (databaseContext.Connection.ConnectionString != null
> -                    ? GetVendor(databaseContext.Connection.ConnectionString)
> +                    ? 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 +431,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 1141)
> +++ src/DbLinq/Vendor/Implementation/Vendor.cs  (copia locale)
> @@ -31,13 +31,14 @@
>  using System.Linq;
>  
>  #if MONO_STRICT
> +using DataContext = System.Data.Linq.DataContext;
> +using Data = System.Data;
>  using System.Data.Linq;
>  #else
> +using DataContext = DbLinq.Data.Linq.DataContext;
> +using Data = DbLinq.Data;
>  using DbLinq.Data.Linq;
>  #endif
> -
> -using Data = DbLinq.Data;
> -
>  using IExecuteResult = System.Data.Linq.IExecuteResult;

I don't see why the above changes are necessary (considering that this
file has been building for quite some time, and none of the changes
below use DataContext/etc.).

>  namespace DbLinq.Vendor.Implementation
> @@ -46,10 +47,12 @@
>      /// some IVendor functionality is the same for many vendors,
>      /// implemented here as virtual functions.
>      /// </summary>
> -#if !MONO_STRICT
> +#if MONO_STRICT
> +    internal
> +#else

Why this change?

>      public
>  #endif
> -    abstract partial class Vendor : IVendor
> + abstract partial class Vendor : IVendor

Why this change?

>      {
>          /// <summary>
>          /// Pings requested DB, true is result is OK.
> @@ -163,7 +166,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))
>              {
> @@ -176,7 +179,7 @@
>                  connectionString    = 
> reConnectionType.Replace(connectionString, "");
>              }
>  
> -            var    connType     = Type.GetType(connTypeVal);
> +            var connType = Type.GetType(connTypeVal);

Can we avoid the whitespace only changes? :-)

Otherwise, looks good.

If you make the above cleanup changes, you can commit.

Thanks,
 - Jon



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"DbLinq" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/dblinq?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to