Unhappy with chapter 4...

Jan 25, 2013 at 1:33 PM

Hello

I bought the book from Wrox to get more understanding about MVC.
So I followed the example program and had an abrupt stop on chapter 4
as some other user too.!

"Illegal characters in path."  --> Result in an exeption error

See my Controller Index below


public ActionResult Index()
{
var genres = storeDB.Genres.ToList(); 
return View(genres);
}

 

Can somebody give me a hint?

Thank you in advance

risi40

 

 

 

 

Jan 28, 2013 at 6:26 PM

Did you put the red markt in the class before the method declaration?


 

{

 MusicStoreEntities storeDB = new MusicStoreEntities ();

 //

 

 // GET: /Store/

 

 public ActionResult Index()

{

 var genres = storeDB.Genres.ToList();

 return

View(genres);

}

 

 

 

 

 

public class StoreController: Controller

Jan 30, 2013 at 7:42 AM

Hello mducrocq68

Thank you for your response

I've same entries as you proposed.

By the way I copied .sdf database into App_Data

Commentet out in Global.asa
// System.Data.Entity.Database.SetInitializer(new MvcMusicStore.Models.SampleData());

This is my Connectionstring in web.config

<connectionStrings>
  <add name="MusicStoreEntities"
  <
connectionString="Data Source=|DataDirectory|MvcMusicStore.sdf"
 
<providerName="System.Data.SqlServerCe.4.0"/>
<connectionstring>

At this time I'm running into another exeption:
The model backing the 'MusicStoreEntities' context has changed since the database was created. Consider using Code First Migrations to update the database 

Whats going wrong ?

Thank you

risi40

 

Jan 31, 2013 at 5:24 PM
Hi Risi40,

Why did you copy the .sdf into the App_Data, in the 1st 4 chapters you aren't told to do that....

That could be the problem, I will check the rest, by the way I use Visual Express 2012 for Web that could also
be a part of the problem because the new version does a lot automaticly...

I'll be bac! ;)

mducrocq68
Jan 31, 2013 at 5:27 PM
Risi40,


Did you do the rest of chapter 4?
Feb 1, 2013 at 2:08 PM
Hello mducrocq68

Thank you very much for your prompt support!

First I've added the database in chapter 4.

Then I made a copy of the of the project and added the sample database and some other modules
directly from the example. I can run the project exept some javescript error.
But this is another issue.
I'll try to find out the difference between the two solution in the next view days.
I'm using VS2012.

Thank you a lot

Risi40