SqlMetal & IUD procs

  • Thread starter Thread starter Andy
  • Start date Start date
A

Andy

Hi,

I use procs for my data access, instead of allowing direct inserts and
updates to tables. How can I get SqlMetal to generate code that will
use procs? I know the designer you can Configure Behavior to do
this.. is there no equivolent in Sql Metal?

Thanks
 
Well, one of the SqlMetal options is to output the dbml (an xml file).
Dbml can be edited (by hand or automated), then you can use SqlMetal
again to generate code from the edited dbml file. To quote from "/?":

Generate intermediate dbml file from SqlServer:
SqlMetal /server:myserver /database:northwind /dbml:northwind.dbml /
namespace:nwind

Generate code with external mapping from dbml:
SqlMetal /code:nwind.cs /map:nwind.map northwind.dbml

I don't think the /map is necessary - i.e. I suspect you coud use /
code:{outfile.cs} {infile.dbml}

Marc
 
Sorry - I forgot to say; to investigate how to link to stored
procedures, the easiest option is to edit a test file via the designer
and see what it does to the .dbml file.

Marc
 
Sorry - I forgot to say; to investigate how to link to stored
procedures, the easiest option is to edit a test file via the designer
and see what it does to the .dbml file.

Hi,

I've been looking at the code the designer generates. I know what it
does to use SPs instead of direct updates, but I was hoping that
there'd be some way to automate all of that work. It basically
amounts to a private method with a specific name / signature, which in
turn calls whatever stored proc. There's some trickery to it though,
since you can't pass value types by reference and so temp variables
are declared and used to manually copy the values back and forth.

I guess there's nothing right now to easily automate what I want...
I'll have to think of something.

Thanks
Andy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top