Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4.5 > BOOK: Professional ASP.NET MVC 4
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Professional ASP.NET MVC 4
This is the forum to discuss the Wrox book Professional ASP.NET MVC 4 by Jon Galloway, Phil Haack, Brad Wilson, K. Scott Allen; ISBN: 978-1-118-34846-8
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional ASP.NET MVC 4 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 Search this Thread Display Modes
  #11 (permalink)  
Old November 1st, 2013, 05:19 AM
Registered User
Points: 22, Level: 1
Points: 22, Level: 1 Points: 22, Level: 1 Points: 22, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2013
Posts: 6
Thanks: 1
Thanked 0 Times in 0 Posts
Default Professional ASp.NEt MVC 4 Woes

Yep, I'm having awful problems with this book too. page 78 creating a StoreManagerController, when selecting New Data Context, ok and Add, VS throws an error saying that the fields have no primary key!!! I have another post here somewhere with the EXACT error being thrown. I was under the impression that Entity Framework creates the database by Modelling the Code in the Classes, either this is false or the book is wrong (either by being badly written or badly formatted by the publisher) and a complete and utter waste of time and more importantly money.

I bought the book hoping it would fare better than the online version which was also frought with bad formatting, e.g. telling the user to run the application and expect results that weren't possible because the code to facilitate this hadn't yet been presented to the student. What is the point of asking someone to do something in part 2 when the code required to do so doesn't appear until part 4?

Don't they have proof readers working for the publisher to ensure the text is correct or not?
  #12 (permalink)  
Old November 1st, 2013, 07:17 AM
Authorized User
Points: 175, Level: 3
Points: 175, Level: 3 Points: 175, Level: 3 Points: 175, Level: 3
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2013
Location: St.Petersburg, Russia
Posts: 36
Thanks: 1
Thanked 4 Times in 4 Posts
Default

I remember that I did it exactly as the book says and it worked fine for me.

If EF cannot figure out Primary Keys of your fields, may be you should take a look at your model classes. You can either use "naming conventions" - fields with "id" in their names, or apply attributes - [Key]

Code:
public class Book 
{ 
    [Key] 
    public string ISBN { get; set; }
And, guys, I do not want to offend anyone, but the book is in "Professional"-series. The readers are supposed to have certain experience in .NET and in Web-programming. The book does not take you by the hand and goes exactly "step by step" as books for beginners do.

If you find it difficult to follow its tempo, may be you should start with grasping the basics of ASP.NET MVC. On asp.net/mvc website there are FREE Pluralsight videos by Scott Allen. Take some time to watch them and I think you will find the book easier to follow afterwards.
The Following User Says Thank You to Oleg Kolpashchikov For This Useful Post:
welshfella23 (November 1st, 2013)
  #13 (permalink)  
Old November 1st, 2013, 08:15 AM
Registered User
Points: 22, Level: 1
Points: 22, Level: 1 Points: 22, Level: 1 Points: 22, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2013
Posts: 6
Thanks: 1
Thanked 0 Times in 0 Posts
Default thanks

Hi, thanks for the reply, have gotten a little further now, there must of been a glitch somewhere. I scrapped my project and started again from scratch, it seems to be working a little better. But I still maintain that the book is NOT written as well as it should be. However, I will persevere, it's the only way to learn :)
  #14 (permalink)  
Old November 1st, 2013, 12:03 PM
Registered User
Points: 22, Level: 1
Points: 22, Level: 1 Points: 22, Level: 1 Points: 22, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2013
Posts: 6
Thanks: 1
Thanked 0 Times in 0 Posts
Default more ASP.Net MVC 4 woes

having gotten up to page 97 I find the methods given in "To Get or to Post" nonsensical. It's all well and good giving code examples for a "form action" and then an "ActionResult", but this is not going to work when the author (or printer/publisher) has omitted to tell the reader the vital part of instantiating the following in the the HomeController:

MvcMusicStoreDbContext _storeDb = new MvcMusicStoreDbContext();

Without the above code placed in the HomeController.cs class the application fails and there is no mention of it in the book! The only thing I can say I have actually learned thus far, is to never buy another book published by Wrox.

How is the reader supposed to know this? They cannot pluck this out of mid air. A shockingly bad example by any standards, no wonder so many potential coders give up the ghost when they are presented with such poor examples and at great expense to boot, these books do not come cheaply.
  #15 (permalink)  
Old November 1st, 2013, 03:37 PM
Authorized User
Points: 175, Level: 3
Points: 175, Level: 3 Points: 175, Level: 3 Points: 175, Level: 3
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2013
Location: St.Petersburg, Russia
Posts: 36
Thanks: 1
Thanked 4 Times in 4 Posts
Default

The code snippet on page 97 shows only the "Search"-method of the HomeController. And it's an example for the discussion of whether to use HTTP GET or HTTP POST.

Normally you should create DBcontext in the controller, not inside the action. And that's why it's not the snippet.
And the action is SO OBVIOUSLY using the storeDB as dbContext by LINQ-query.

Go back to Chapter 4 on models and read again. Or better yet, learn some basics of Entity Framework and LINQ. These technologies are separate from ASP.NET MVC and are not supposed to be explained in every little detail.
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
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
The ajax in this is terrible, why use it? ppwalks BOOK: Professional CodeIgniter ISBN: 978-0-470-28245-8 0 April 25th, 2012 08:42 AM
I am finding the book a bit over my head pinball2k BOOK: Professional Android Application Development ISBN: 978-0-470-34471-2 2 November 30th, 2008 02:40 PM
Terrible book... markinro BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 4 July 18th, 2008 11:57 AM
finding free book "Beginning Jsp Book" ruzdi JSP Basics 0 December 7th, 2007 01:46 PM
Terrible error: The page cannot be displayed csun ASP.NET 1.0 and 1.1 Basics 2 November 9th, 2004 10:16 AM



All times are GMT -4. The time now is 12:24 PM.


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