5

I'm using LinqPad to query a MySQL MyISAM database. There are foreign keys, but no constraints on them, so LinqPad can't pick up the relationship. I'd like to add these relationships (tell it which fields are FKs) to make querying easier. Is this possible?

mpen
  • 272,448
  • 266
  • 850
  • 1,236

2 Answers2

2

There's no way to do this other than adding the foreign key constraints. (As a matter of interest, what's the reason for not having foreign key constraints?)

Joe Albahari
  • 30,118
  • 7
  • 80
  • 91
  • Hence why I specifically included "MyISAM" in my question :) It doesn't support FKs. InnoDB does, MyISAM doesn't. And anyway, I didn't design the DB. I would have went InnoDB. http://dev.mysql.com/doc/refman/5.0/en/ansi-diff-foreign-keys.html – mpen Nov 08 '11 at 02:25
1

If there aren't FKs set up, then you only have one option.

You must join your tables manually using LINQ.

If you really want to use dot-notation, I think you can change your statement type to "C# Program" and put the LINQ in an extension method.

Scott Rippey
  • 15,614
  • 5
  • 70
  • 85