Issue 280 in dblinq2007: exception when 2 foreign keys on a table point to the same fiel on another table

3 views
Skip to first unread message

dblin...@googlecode.com

unread,
Aug 25, 2010, 5:46:23 AM8/25/10
to dblin...@googlegroups.com
Status: New
Owner: ----

New issue 280 by danjal85: exception when 2 foreign keys on a table point
to the same fiel on another table
http://code.google.com/p/dblinq2007/issues/detail?id=280

What steps will reproduce the problem?
1. create a table
2. create 1:n assosiation from that table to itself using another table

like
Table A (ID, Text)
and now a row in a is related to several rows in A.
I did that with a new Table

Table B (IDSource, IDRelated)
where IDSource is a FK to A.ID and IDReleated is a FK to A.ID

3.run dbmetal on that database

What is the expected output? What do you see instead?
a .cs file got exception

What version of the product are you using? On what operating system?
using latest dblinq 0.20.1 on windows7 64 bit

Please provide any additional information below.
crash occurs in Processor.cs line 141;

i changed the code to:
var otherAssociation = otherType.Associations.Where(a => a.Type ==
table.Type.Name && a.ThisKey == association.OtherKey).First<Association>();

it created the cs file now, but i didnt test it yet.

for further questions plz contact me using feanzi[at]yahoo.de as mail
address

dblin...@googlecode.com

unread,
Apr 8, 2013, 11:15:14 PM4/8/13
to dblin...@googlegroups.com

Comment #1 on issue 280 by Goroh...@gmail.com: exception when 2 foreign
keys on a table point to the same fiel on another table
http://code.google.com/p/dblinq2007/issues/detail?id=280

May be this version of code line is better:
var otherAssociation = otherType.Associations.Single(a => a.Type ==
table.Type.Name && a.ThisKey == association.OtherKey && a.OtherKey ==
association.ThisKey);
Now association selected by table name, destination column and source
column. In your example FK matches by 2 first conditions.

--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings
Reply all
Reply to author
Forward
0 new messages