Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: ASP.NET 3.5 Enterprise Application Development with Visual Studio 2008: Problem Design Solutio
This is the forum to discuss the Wrox book ASP.NET 3.5 Enterprise Application Development with Visual Studio 2008: Problem Design Solution by Vincent Varallo; ISBN: 9780470396865
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET 3.5 Enterprise Application Development with Visual Studio 2008: Problem Design Solutio section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Display Modes
  #1 (permalink)  
Old April 16th, 2009, 09:16 PM
Authorized User
Join Date: Mar 2009
Posts: 17
Thanks: 1
Thanked 0 Times in 0 Posts
Default Chapter 7 Workflow setup issues and questions

These comments on Chapter 7 relate upto page 216.

First, there is a missing Stored Procedure in the Chapter7WorkflowStoredProcedures file.
The procedure is ENTWFItemSelectByWorkflowId. This procedure can be found in the
FinalDBScriptWithData.sql file.

Second, there is an extra Stored Procedure for State Property table. The procedure is
ENTWFStatePropertyDeleteByENTWFStateId. I dropped it into the Methods pane of the ORB, since this Stored Procedure has not been mentioned as yet in the chapter. There is no Delete property to which the procedure can be connected, such as the standard StatePropertyDelete procedure. There are no compile errors for the DAL. I don't know if this is correct?

There are four Stored Procedures that return the error message "One or more selected
database objects return a schema that does not match the schema of the target data class. Nothing has been added to the designer." The procedures are: ENTWFItemOwnerSelectedLastUserByGroupID,
ENTWFOwnerGroupSelectCountBynameWorkflowId, ENTWFStateSelectCountByENTWFOwnerGroupId, and

I dropped these Stored Procedures into the Methods pane of the ORB, which appears to work. I expected a return value of int, as with the ENTWFTransitionSelectByFromStateId, but it appears a single item return will occur. Again, I have no idea, if this is the correct
approach or not?

Lastly, HRPaidTimeOffDataContext.cs was copied from the download. Everytime the ORB is changed, the HRPaidTimeOff.designer.cs file is recreated. There is now a conflict with the HRPaidTimeOffDataContext.cs for the ENTWFTransitionSelectByStateId, which must be again deleted from the designer. I inferred from the book that the HRPaidTimeOffDataContext.cs was an override, what have I missed?

Thanks in advanced for any assistance and/or comments.
  #2 (permalink)  
Old April 17th, 2009, 02:09 PM
Authorized User
Join Date: Apr 2009
Posts: 41
Thanks: 1
Thanked 2 Times in 2 Posts

Hi TDewey -

I don't think the extra stored procedure will cause any problems. It's part of the datacontext, but nothing calls it (at least as of Chapter 7), so it's probably the code equivalent of an appendix :)

The reason you're seeing the "One or more selected
database objects return a schema that does not match the schema of the target data class. Nothing has been added to the designer." error with the four procs you listed is because they're returning a different result set than the tables.

In my observations (having had the same problem), when you drop a select stored procedure onto a table in the ORM, it expects the result set to match the table definition. The four "offending" procs each return a different result set. For example,
ENTWFItemOwnerSelectLastUserByGroupId returns the TOP 1 ENTUserAccountId based on the parameters passed in, rather than all the columns from ENTWFItemOwner.

If you look at the donwloaded designer file (which is what I did), you'll see that Vince has 4 additional classes in the designer. To continue with the proc above, there's a class called "ENTWFItemOwnerSelectLastUserByGroupIdResult. It has one property - ENTUserAccountId. Dragging the ENTWFItemOwnerSelectLastUserByGroupId stored proc onto that class will result in no errors.

You can drop the offending procs onto the method pane of the ORM, but you may run into problems later as the code will be expecting to reference a property from the corresponding class.

Lastly, HRPaidTimeOffDataContext.cs is not an override. It's a partial class. Any time you make a change to the HRPaidTimeOff.dbml file that results in ENTWFTransitionSelectByStateId being added to it, you will get the conflict. To avoid that, whenever you change the .dbml file just don't add the ENTWFTransitionSelectByStateId proc to it - it's already handled by the HRPaidTimeOffDataContext.cs file that has the partial class definition in it.

Hope this helps.

  #3 (permalink)  
Old April 19th, 2009, 07:23 PM
Authorized User
Join Date: Mar 2009
Posts: 17
Thanks: 1
Thanked 0 Times in 0 Posts


Thanks for the reply.

I imported the code in the DAL, but did not import the ORM and associated designer.cs file, as I was working directly on ORM. The missing stored procedures do cause build errors; this was how I found them.

In reference to ENTWFItemOwnerSelectLastByGroupId, I'm not sure what you mean by dragging the SP onto the class. I found the class (ENTWFItem...Result) in the designer.cs file, which appears to be generated when I dropped the SP onto the Methods pane. I can't drag the SP from the Server Explorer onto the designer.cs file.

I misinterpreted the statement in the book about ENTWFTransitionSelectByStateId -- "Delete the method from the ORM Designer". I should have deleted the stored procedure from the ORM Designer versus the method from the designer.cs file.

Thanks for your help
  #4 (permalink)  
Old April 21st, 2009, 12:22 AM
Wrox Author
Join Date: Jan 2009
Posts: 73
Thanks: 0
Thanked 7 Times in 7 Posts

Hi Tom,
You are right, I checked the sample file and the chapter 7 stored procedure file is missing the ENTWFItemSelectByWorkflowId proc, but as you said it is in the final db script. I'll have them change it on the site.

To your second point, the ENTWFStatePropertyDeleteByENTWFStateId proc is called in the ENTWFStatePropertyData class in the DeleteByENTWFStateId method. This method is called by the Delete method of the ENTWFStatePropertyEO class. This is referenced on page 220 in the book.

To your third point, not all resultset returning procedures map to a table. If the proc is custom, which these are, then you can just drag the proc onto the Methods pain of the ORM designer. The designer will automatically create a class called PROCNAMEResult which will contain a property for each field returned from the procedure. The 4 procs that your reference return counts or top records so they don't map to a table. I just read through that part of the chapter again and it doesn't specifically state this so I can see how it can be confusing.

Hope this helps

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Issues with Chapter 6 Donnynag BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 2 January 3rd, 2009 02:38 PM
Chapter 1 - Two questions mikener BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 6 March 17th, 2008 04:59 PM
Chapter 4 issues HenryT BOOK: Professional SQL Server Reporting Services ISBN: 0-7645-6878-7 1 June 9th, 2004 03:49 PM

All times are GMT -4. The time now is 03:32 AM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.