Wrox Programmer Forums
|
BOOK: Professional ASP.NET MVC 5
This is the forum to discuss the Wrox book Professional ASP.NET MVC 5 by Jon Galloway, Brad Wilson, K. Scott Allen, David Matson; ISBN: 978-1-118-79475-3
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional ASP.NET MVC 5 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 11th, 2015, 04:40 PM
Registered User
 
Join Date: Mar 2006
Posts: 9
Thanks: 1
Thanked 1 Time in 1 Post
Default p87 Scaffolding Question

Hi Folks,

If Mr Galloway and Co are reading, I'm thoroughly enjoying your book. Just a quick query please.

1. Is there a reason we create a new db context instead of using the existing ApplicationDbContext?

2. I want to stamp any changes to an album with a userID so added the following to the Album class.
Code:
public virtual ApplicationUser SubmittedBy { get; set; }
public virtual ApplicationUser ModifiedBy { get; set; }
but when I try to add a controler as per p87 in the book I get the below error, even after cleaning, building and rebuilding the project.

I also added the following to ApplicationUser class to try to resolve the issue but no joy

Code:
 [Key]
        public virtual int ApplicationUserId { get; set; }
Could the issue be that the IdentityModels with their own DbContext are in the same folder as the rest of my models?

Code:
There was an error running the selected code generator:

'Unable to retrieve metadata for 'MvcMusicStorePrototype.Models.Album'. 

One or more validation errors were detected during model generation:

IdentityUserLogin: : EntityType 'IdentityUserLogin' has no key defined. Define the key for this EntityType.

IdentityUserRole: : EntityType 'IdentityUserRole' has no key defined. Define the key for this EntityType.

IdentityUserLogins: EntityType: EntitySet 'IdentityUserLogins' is based on type 'IdentityUserLogin' that has no keys defined.

IdentityUserRoles: EntityType: EntitySet 'IdentityUserRoles' is based on type 'IdentityUserRole' that has no keys defined.

'





Similar Threads
Thread Thread Starter Forum Replies Last Post
Difficulty with Chapter 4 and scaffolding eswitzer BOOK: Professional ASP.NET MVC 5 3 March 25th, 2015 02:34 AM
Scaffolding 05beckga BOOK: Professional ASP.NET MVC 5 3 October 31st, 2014 12:19 PM
Disappearing UserName & Question within Customized PasswordRecovery Question Template eddiemcham ASP.NET 3.5 Basics 13 June 13th, 2009 04:23 AM
Scaffolding problem johnisdumb BOOK: Beginning Ruby on Rails 3 June 19th, 2007 10:41 AM
chapter 3 p87 michaelcode BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 0 March 24th, 2006 02:34 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.