question about linq2mysql and FK,PK relationships (MARS)

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for MySQL
Post Reply
Posts: 27
Joined: Mon 08 Sep 2008 16:37

question about linq2mysql and FK,PK relationships (MARS)

Post by » Thu 02 Oct 2008 21:13


First of all i would like to thank you guys very much for the great job developing linq2mysql!.
I'm really into this, and if i can be of any assistance during developing/testing of this product, please do let me know.

Do you want me to send you guys flowers for making this product ?

I already started developing with the linqsupport beta, but i've noticed the following:

- I use visual studio 2008 with the 3.5 framework
- I am using innodb tables, for making a relational database.
- I used linqsupport beta to reverse enigineer the linq classes.

So, now it seems that when i'm writing a linq query, that at the moment there is no support for a 'lazy read', meaning that when i retrieve a objectcollection (tblUsers for example) with foreign key to another table (tblUserProperties for example), i'm not capable of accessing tblUserProperties from that query.

in other words, in the beta, so it seems the linqsupport is not capable of creating/managing joins to other tables.

linq Code example:

var module = from m in db.Modules
where m.Modulesinroless. --> here the intellisense stops, but i should be able to retrieve the properties of the 'modulesinrows' table, because they have a innodb reference.

(so i've read for sql server), the DB needs to support MARS (Multiple Active Result Sets), but i don't find any relevant hits on google for MySql and MARS).


Is your linq2mysql product going to support 'quering with DB relationships'

Posts: 725
Joined: Thu 28 Oct 2004 14:06

Post by Paul » Fri 03 Oct 2008 09:31

Thank you for your gratitudes. Please explain on a example which data loading you want to be "lazy"?
If your object "User" has property "UserProperties" of EntitySet type, it is
loaded from server when you are accessing User.UserProperties property.
If your object "User" has property "Company" of EntityRef type, it is
loaded from server when you are accessing User.Company property.
If you run query

var q = (from u in db.Users
select new { u , properties = from p in db.UserProperties where p.User == u select p});

then ".properties" is
loaded from server when you are accessing this property.

Intellisense in the IDE works with code of Microsoft Visual Studio. Our library starts working in run time only. Please check the type of m.Modulesinroless. Possibly it is a list.

MySQL Server does not support MARS (Multiple Active Result Sets). But it is not needed for running LINQ to MySQL. The library has its own solution for the problem and can work with multiple opened data readers at the same time.

If you have a question please write an example LINQ code and specify declaration for instance objects.
Posts: 27
Joined: Mon 08 Sep 2008 16:37

don't know what happened

Post by » Fri 03 Oct 2008 13:06


Thanks for your quick response. I tried to isolate the problem but with no success. I dropped the tables, recreated them and rebuild the class, everything works fine now.

Probably my mistake somewhere.

Post Reply