MySQL with stored procedures

9 views
Skip to first unread message

brun...@gmail.com

unread,
May 20, 2008, 6:06:24 PM5/20/08
to DbLinq, brun...@yahoo.com
Hi,

I have played with MySql and DbLinq within the context of stored
procedures. Running simple stored procedures works very nicely, with
Intellisense showing all of the parameters. (Nice work!)

I have one stored procedure that returns rows that correspond
instances of a class. How to I tweak the DBMetal generated code to
teach the system that if I call "GetAllProjects()", that I really want
an array of Projects (a Project[]). So what I really want is:

IEnumerable<Project> projects = GetAllProjects()
foreach (project p in projects)
Console.WriteLine(p.Name);

I have been able to call Get AllProjects and return a DataSet, which
has the correct information in it.
Project is a code-generated entity in the DBMetal generated code.

Thanks in advance,

Friedrich

Jiri Moudry

unread,
May 21, 2008, 7:14:23 AM5/21/08
to DbLinq
Hallo Friedrich,
If I understand your question correctly, you would like the stored
proc to return a business object instead of a DataReader.

The problem is that determining the result shape is complicated.
Microsoft Linq-to-Sql determines the shape by parsing the stored proc
body, but we don't have this functionality.

We could enhance VisualMetal to give you the option of invoking your
stored proc to determine the result shape.

In the meantime, you could try this workaround:
db.ExecuteQuery<Project>("CALL myproc( {0},{1} )", param1, param2 );

brun...@gmail.com

unread,
May 21, 2008, 8:34:30 PM5/21/08
to DbLinq
Jiri,

I will give your workaround a try -- if this actually works it would
be wonderful, but you do lose the Intellisense of VisualStudio.

Friedrich
Reply all
Reply to author
Forward
0 new messages