marcodelpin / dblinq2007

Automatically exported from code.google.com/p/dblinq2007
Other
0 stars 0 forks source link

DBMetal doesn't support databases contains tables with foreign keys that reference keys in an other database #265

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.create 2 database : The first database contains tables with meta data for my 
application. 
The other database contains tables with foreign keys that reference tables of 
the first database.
2.Use DBMetal against the second database

What is the expected output? What do you see instead?
a .dbml file

What version of the product are you using? On what operating system?
0.19

Please provide any additional information below.
I got the following exception :

DbMetal failed:System.Collections.Generic.KeyNotFoundException: La clé donnée 
ét
ait absente du dictionnaire.
   à System.ThrowHelper.ThrowKeyNotFoundException()
   à System.Collections.Generic.Dictionary`2.get_Item(TKey key)
   à DbLinq.Vendor.Implementation.SchemaLoader.LoadForeignKey(Database schema, T
able table, String columnName, String tableName, String tableSchema, String refe
rencedColumnName, String referencedTableName, String referencedTableSchema, Stri
ng constraintName, NameFormat nameFormat, Names names)
   à DbLinq.MySql.MySqlSchemaLoader.LoadConstraints(Database schema, SchemaName
schemaName, IDbConnection conn, NameFormat nameFormat, Names names)
   à DbLinq.Vendor.Implementation.SchemaLoader.Load(String databaseName, INameAl
iases nameAliases, NameFormat nameFormat, Boolean loadStoredProcedures, String c
ontextNamespace, String entityNamespace)
   à DbMetal.Generator.Implementation.Processor.ReadSchema(Parameters parameters
, ISchemaLoader& schemaLoader)
   à DbMetal.Generator.Implementation.Processor.ProcessSchema(Parameters paramet
ers)

Original issue reported on code.google.com by martials...@gmail.com on 17 Jul 2010 at 8:53

GoogleCodeExporter commented 9 years ago
What database is this?  Similar bugs were fixed in Sqlite, e.g. Issue 134 
(fixed in 0.20), though this appears to be in MySQL based on the stack trace.

Alternatively, could this be a case sensitivity issue?  See Issue 167 and/or 
Issue 200 (which were closed due to lack of response).

Basically, I need an easy way to reproduce this, and no simple reproductions 
have been created yet.

Original comment by jonmpr...@gmail.com on 17 Jul 2010 at 2:12

GoogleCodeExporter commented 9 years ago
1)I use MySQL database.

2)I attached a file with a script to reproduce it.

3)When I run DBMetal in debug mode it seems that it cannot build an association 
cause the database tables dictionary does not contain any entry for the desired 
table name (see screen shots).

4)It’s not a bug cause when I run DBMetal I run it against only one database 
so I guess the dictiobary contains only tables in that database.
The fact is that when a foreign key reference a table in another database 
DBLink will currently look for this table into the dictionary of the current 
database and it won’t find so the KeyNotFoundException is raised.

5)Is it possible to make possible to run DBMetal over more than one databse? 
Could you add this functionality in a release of DBLinq?

Original comment by martials...@gmail.com on 19 Jul 2010 at 11:56

Attachments: