Go Back

Web Service Factory for WCF (Part 2) - Creating CRUD Sprocs and Repositories

 

Last time we created our business entities using the database, I probably should have created my stored procedures first, but I didn’t. We’re going to do that now.

 

Go ahead an run the “Create CRUD stored procedures” recipe.

 

Select everything (some stuff has incompatible types, I’m sure we’ll get to deal with those later).

image001.jpg

 

It gives you a chance to change the names and select/deselect any methods. I’m going to go with defaults and do everything.

image002.jpg

I hit Next.

 

I get this window to name the stored procedures file.

image003.jpg

 

So now I’m going to try this out in Management Studio.

image004.jpg

It seemed to run, now to check programmability to see…

 

WARNING! You have to add a line to the top of the sql to USE AdventureWorks, or  you’ll be adding all of thosed stored procedures to master, and have to remove them manually, NOT FUN. (I learned the hard way)

image005.jpg

Ok, they’re all in there now…

 

Next recipe is “Create data repositories from business entities”

image006.jpg

Target the DataAccess project.

Choose our AdventureWorks connection.

 

Let’s do HR:

image007.jpg

This should give us enough to play with.

image008.jpg

You might want to go into each operation and peek at what’s going on here, basically every one of these methods maps to a stored procedure then every single parameter must map to a business entity property.

 

HIT FINISH.

 

 

It generates the repository objects. Explaining what the generics in this do is a topic for another blog(or series)

 

Facebook DZone It! Digg It! StumbleUpon Technorati Del.icio.us NewsVine Reddit Blinklist Furl it!

Post a comment!
  1. Formatting options