Merge pull request #4621 from alexanderkyte/strdup_env
[mono.git] / mcs / class / System.Data.Linq / src / DbLinq / Data / Linq / DataContext.cs
index 9e8c0b02fe18ac71edb7fe784fd0b2416eb3ae09..db68b96777b3473655a9a97785e4452b77f7157f 100644 (file)
@@ -192,12 +192,12 @@ namespace DbLinq.Data.Linq
         /// </summary>\r
         /// <param name="connectionString">specifies file or server connection</param>\r
         [DbLinqToDo]\r
-        public DataContext(string connectionString)\r
+        public DataContext(string fileOrServerOrConnection)\r
         {\r
             Profiler.At("START DataContext(string)");\r
-            IVendor ivendor = GetVendor(ref connectionString);\r
+            IVendor ivendor = GetVendor(ref fileOrServerOrConnection);\r
 \r
-            IDbConnection dbConnection = ivendor.CreateDbConnection(connectionString);\r
+            IDbConnection dbConnection = ivendor.CreateDbConnection(fileOrServerOrConnection);\r
             Init(new DatabaseContext(dbConnection), null, ivendor);\r
 \r
             Profiler.At("END DataContext(string)");\r
@@ -294,7 +294,11 @@ namespace DbLinq.Data.Linq
             _VendorProvider = ObjectFactory.Get<IVendorProvider>();\r
             Vendor = vendor ?? \r
                 (connectionString != null ? GetVendor(ref connectionString) : null) ??\r
+#if MOBILE\r
+                _VendorProvider.FindVendorByProviderType(typeof(DbLinq.Sqlite.SqliteSqlProvider));\r
+#else\r
                 _VendorProvider.FindVendorByProviderType(typeof(SqlClient.Sql2005Provider));\r
+#endif\r
             \r
             DatabaseContext = databaseContext;\r
 \r
@@ -826,9 +830,12 @@ namespace DbLinq.Data.Linq
             }\r
         }\r
 \r
-               private static MethodInfo _WhereMethod = typeof(Queryable).GetMethods().First(m => m.Name == "Where");\r
+               private static MethodInfo _WhereMethod;\r
         internal object GetOtherTableQuery(Expression predicate, ParameterExpression parameter, Type otherTableType, IQueryable otherTable)\r
         {\r
+            if (_WhereMethod == null)\r
+                System.Threading.Interlocked.CompareExchange (ref _WhereMethod, typeof(Queryable).GetMethods().First(m => m.Name == "Where"), null);\r
+\r
             //predicate: other.EmployeeID== "WARTH"\r
             Expression lambdaPredicate = Expression.Lambda(predicate, parameter);\r
             //lambdaPredicate: other=>other.EmployeeID== "WARTH"\r