Minor note: when pasting exception messages, *please* disable line
wrapping in your email client (at least for the parts containing the
stack trace). It's *very* difficult to read a stack trace which has
been line-wrapped.
The problem is that DbMetal is too smart for it's own good.
Specifically, DbMetal.exe.config specifies which DB connection type to
use, but the type it specifies is NOT fully qualified. For example:
<provider name="Oracle"
dbLinqSchemaLoader="DbLinq.Oracle.OracleSchemaLoader, DbLinq.Oracle"
databaseConnection="System.Data.OracleClient.OracleConnection,
System.Data.OracleClient" />
The //provider/@databaseConnection attribute doesn't contain a
fully-qualified type name. Consequently, Type.GetType() fails.
DbMetal tries to "correct" this by installing an
AppDomain.AssemblyResolve "hook", and then proceeds to dig into the GAC
trying to look for the System.Data.OracleClient with the highest version
number.
This is dubious, at best.
In your case, this "hook" dies because it parses the GAC directory name
and assumes it's a valid System.Version value. Apparently it isn't.
Specifically in SchemaLoaderFactory.cs:212-214:
foreach (string versionDirectory in
Directory.GetDirectories(assemblyDirectory))
{
var testVersion = new
Version(Path.GetFileName(versionDirectory).Split('_')[0]);
A vaguely related question is: what is the GAC directory that contains
your System.Data.OracleClient.dll?
Regardless, the solution to your problem is to do this:
1. Find out the fully-qualified assembly name for
System.Data.OracleClient.OracleConnection. You can find this out by
writing a program that does:
Console.WriteLine(typeof(OracleConnection).AssemblyQualifiedName);
2. Edit DbMetal.exe.config and replace
the //provider[name="Oracle"]/@databaseConnection attribute value with
the output from (1).
This will allow Type.GetType() to actually find OracleConnection, thus
bypassing DbMetal's attempt at parsing GAC directories.
- Jon
On Wed, 2009-10-14 at 03:40 -0700, Magickal wrote:
>
>
> Hi, I am trying to generate linq clases for my oracle database.
>
> I downloaded the latest version of DbLinq from svn, built it. I then
> copied the batch script run_oraMetal.bat to the folder build.dbg and
> udpated the batch script to have the appropriate connection details.
>
> I can see that I do have System.Data.OracleClient installed in the
> GAC.
>
>
>
> The error I get is;
>
> DbMetal failed:System.IO.FileLoadException: Could not load file or
> assembly 'Sys
> tem.Data.OracleClient' or one of its dependencies. The format of one
> argument do
> es not meet the contract of the method. (Exception from HRESULT:
> 0x80131537)
> File name: 'System.Data.OracleClient' ---> System.FormatException:
> Input string
> was not in a correct format.
> at System.Number.StringToNumber(String str, NumberStyles options,
> NumberBuffe
> r& number, NumberFormatInfo info, Boolean parseDecimal)
> at System.Number.ParseInt32(String s, NumberStyles style,
> NumberFormatInfo in
> fo)
> at System.Version..ctor(String version)
> at
> DbMetal.Generator.Implementation.SchemaLoaderFactory.GacLoadAssembly
> (Strin
> g shortName, String directory) in C:\temp
> \DbLinq-0.18\DbLinq-14102009\src\DbMeta
> l\Generator\Implementation\SchemaLoaderFactory.cs:line 214
> at
> DbMetal.Generator.Implementation.SchemaLoaderFactory.GacLoadAssembly
> (Strin
> g shortName) in C:\temp\DbLinq-0.18\DbLinq-14102009\src\DbMetal
> \Generator\Implem
> entation\SchemaLoaderFactory.cs:line 199
> at
> DbMetal.Generator.Implementation.SchemaLoaderFactory.CurrentDomain_Assembl
> yResolve(Object sender, ResolveEventArgs args) in C:\temp
> \DbLinq-0.18\DbLinq-141
> 02009\src\DbMetal\Generator\Implementation\SchemaLoaderFactory.cs:line
> 184
> at System.AppDomain.OnAssemblyResolveEvent(String assemblyFullName)
> at System.RuntimeTypeHandle._GetTypeByName(String name, Boolean
> throwOnError,
> Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark&
> stackMark, Boolean
> loadTypeFromPartialName)
> at System.RuntimeTypeHandle.GetTypeByName(String name, Boolean
> throwOnError,
> Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark)
> at System.RuntimeType.PrivateGetType(String typeName, Boolean
> throwOnError, B
> oolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark)
> at System.Type.GetType(String typeName)
> at DbMetal.Generator.Implementation.SchemaLoaderFactory.Load
> (Parameters param
> eters, String dbLinqSchemaLoaderTypeName, String
> databaseConnectionTypeName) in
> C:\temp\DbLinq-0.18\DbLinq-14102009\src\DbMetal\Generator
> \Implementation\SchemaL
> oaderFactory.cs:line 135
> at DbMetal.Generator.Implementation.SchemaLoaderFactory.Load
> (Parameters param
> eters) in C:\temp\DbLinq-0.18\DbLinq-14102009\src\DbMetal\Generator
> \Implementati
> on\SchemaLoaderFactory.cs:line 64
> at DbMetal.Generator.Implementation.Processor.ReadSchema(Parameters
> parameter
> s, ISchemaLoader& schemaLoader) in C:\temp
> \DbLinq-0.18\DbLinq-14102009\src\DbMet
> al\Generator\Implementation\Processor.cs:line 215
> at DbMetal.Generator.Implementation.Processor.ProcessSchema
> (Parameters parame
> ters) in C:\temp\DbLinq-0.18\DbLinq-14102009\src\DbMetal\Generator
> \Implementatio
> n\Processor.cs:line 112
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---