This project is read-only.

Qurious behavior in StoreController

Dec 7, 2010 at 2:27 AM
Edited Dec 7, 2010 at 4:14 AM


I would first thank the author of this project and for his detailed documentation. This really is a MVC knowledge gold mine.

I am new in and i was folowing your document step by step by step to create the Music Store solution.

My first problem apeared on the page 56 of the document where we connect StoreController/Browse method to the DB using LINQ querry.

In my solution  the obect sets Album and Genre of the MusicStoreEntities, are called in singular, just like the DB tables corresponding to each of those class.

But in your LINQ querry those object sets  are written in plural:

var genreModel = storeDB.Genres.Include("Albums") .Single(g => g.Name == genre);

see storeDB.Genres and Include("Albums")


I dont know if my MusicStoreEntities have some problems but for me inside the StorController/Browse i need to write them in singular like this to make them work

var genreModel = storeDB.Genre.Include("Album").Single(g => g.Name == genre);:

But when i open up your solution and run it i saw that it actually works and uses the same line as the one from the document that does not work in MY example..

Can somebody explain me whats going on?

Thanks in advance