So, I tried it under Mono. It now builds, but does not run.
There seem a couple of reasons why:
- Assembly.Load("System.Data.Linq.dll" won't work, since it is
not in current current directory but in the GAC (you can try
Assembly.Load("System.Data.dll") on .NET - it won't work).
For now I just skipped assembly load phase by just supplying
typeof(DataContext).Assembly (= S.D.linq.dll itself).
I'm not sure if it doesn't really matter in DBLinq land. It will
fail when DbLinq.dll and DbLinq.VendorFoo.dll reside differently.
- DbLinq.Vendor.Implementation.Vendor.CreateDbConnection() tries
to create IDbConnection and then it simply fails, saying:
> DataContext ctor: Assembly load failed for System.Data.SQLite.DLL:
> System.IO.FileNotFoundException: Could not load file or assembly
> 'System.Data.SQLite.DLL' or one of its dependencies. The system
> cannot find the file specified.
> File name: 'System.Data.SQLite.DLL'
I guess it may happen to non-strict version of DBLinq when referenced
-by-name assemblies do not exist at run-time (only in-use DB provider
assembly has to exist, right?).
I also noticed that .ctor(string, MappingSource) could be implemented
easily. I'm attaching a patch. (Note: it contains mono workaround
for the first issue. Second issue is not fixed.)
Atsushi Eno
Atsushi Eno wrote:
> Oops, yes, I use only Makefile and relevant mono scripts that
> mono build system generates. I've added vendor files (things
> like SqlServerProvider.cs but for every other vendor) only in
> mono build script. I've just added files to System.Data.Linq.csproj
> as well.
>
> Jiri, thanks for taking care of it. Now it should build (it builds
> at least with System.Data.Linq.csproj). It's already 6:30 AM, so
> I'll try it on mono tomorrow.
>
> Atsushi Eno
>
> For now I'm going to sleep but if
>
> Atsushi Eno
>
>
> Jiri Moudry wrote:
>> Apologies guys - I am fixing this right now.
>> Nobody answered my question - how do you typically compile
>> MONO_STRICT?
>> Is there a script checked in, or do you use MonoDevelop/SharpDevelop?
>>
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---
Index: src/DbLinq/Data/Linq/DataContext.cs
===================================================================
--- src/DbLinq/Data/Linq/DataContext.cs (revision 116918)
+++ src/DbLinq/Data/Linq/DataContext.cs (working copy)
@@ -106,12 +106,6 @@
Init(new DatabaseContext(connection), null, null);
}
- [DbLinqToDo]
- public DataContext(string fileOrServerOrConnection, MappingSource
mapping)
- {
- throw new NotImplementedException();
- }
-
/// <summary>
/// Construct DataContext, given a connectionString.
/// To determine which DB type to go against, we look for
'DbLinqProvider=xxx' substring.
@@ -121,14 +115,22 @@
/// DbLinqProvider=Mysql
/// DbLinqProvider=Oracle etc.
/// </summary>
- /// <param name="connectionString">specifies file or server
connection</param>
+ /// <param name="fileOrServerOrConnection">specifies file or server
connection</param>
[DbLinqToDo]
- public DataContext(string connectionString)
+ public DataContext(string fileOrServerOrConnection)
+ : this (fileOrServerOrConnection, null)
{
+ }
+
+ [DbLinqToDo]
+ public DataContext(string fileOrServerOrConnection, MappingSource
mapping)
+ {
#region DataContext connectionString ctor
- if (connectionString == null)
- throw new ArgumentNullException("connectionString");
+ if (fileOrServerOrConnection == null)
+ throw new ArgumentNullException("fileOrServerOrConnection");
+ string connectionString = fileOrServerOrConnection;
+
System.Text.RegularExpressions.Regex reProvider
= new
System.Text.RegularExpressions.Regex(@"DbLinqProvider=([\w\.]+)");
@@ -146,7 +148,7 @@
#if MONO_STRICT
//Pascal says on the forum:
//[in MONO] "all vendors are (will be) embedded in the
System.Data.Linq assembly"
- assemblyToLoad = "System.Data.Linq.dll";
+ assemblyToLoad = null;
vendorClassToLoad = match.Groups[1].Value; //eg. "MySql"
#else
//plain DbLinq - non MONO:
@@ -172,8 +174,12 @@
Assembly assy;
try
{
+#if MONO_STRICT
+ assy = typeof (DataContext).Assembly;
+#else
//TODO: check if DLL is already loaded?
assy = Assembly.LoadFrom(assemblyToLoad);
+#endif
}
catch (Exception ex)
{