Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8378931
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T16:02:44+00:00 2026-06-09T16:02:44+00:00

I am following the ASP MVC 3 music store tutorial–translating the C# into VB.

  • 0

I am following the ASP MVC 3 music store tutorial–translating the C# into VB.
http://www.asp.net/mvc/tutorials/mvc-music-store/mvc-music-store-part-4

I have a class called SampleData that is supposed to hold the data for the application. It looks like this:

 Public Class SampleData
        Inherits DropCreateDatabaseIfModelChanges(Of MusicStoreEntities)

        Protected Overrides Sub Seed(context As MusicStoreEntities)
            Dim genres As Genre() = { _
                New Genre() With {.name = "Rock"},
                New Genre() With {.name = "Jazz"},
               ... more genres...
             }

I have a class called MusicStoreEntities that inherits from DbContext like this:

Public Class MusicStoreEntities
    Inherits DbContext

    Property albums As DbSet(Of Album)
    Property genres As DbSet(Of Genre)

My controller is supposed to return a view that lists the genres but the list of genres is empty.

    ' GET: /Store
    Dim storeDB As MusicStoreEntities = New MusicStoreEntities()

    Function Index() As ActionResult
        Dim genres As List(Of Genre) = storeDB.genres.ToList
        Return View(genres)
    End Function

I am also calling my seed in Application_start, located in global.asax

Sub Application_Start()
    System.Data.Entity.Database.SetInitializer(
           New MvcMusicStore.Models.SampleData())

Basically, I should see all of the genres but don’t.

enter image description here

I have no idea how to go about debugging. Where do I start?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T16:02:46+00:00Added an answer on June 9, 2026 at 4:02 pm

    Are you calling your seed in your Application_start, located in global.asax?

    I don’t know vb but here’s the c#:

    protected void Application_Start() {
        Database.SetInitializer(new SampleData());
    }
    

    Altering DropCreateDatabaseIfModelChanges to DropCreateDatabaseAlways could also help, it will force your database to drop and reseed every time the program is run.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to pick up ASP.Net - and following the mvc tutorial: http://www.asp.net/mvc/tutorials/mvc-music-store-part-4
I am following this tutorial http://www.asp.net/mvc/tutorials/mvc-music-store/mvc-music-store-part-9 (not exactly same as this) I am trying
I was following this tutorial http://www.asp.net/mvc/tutorials/mvc-music-store when I stumbled on this piece of code.
I am using this guide: http://www.asp.net/mvc/tutorials/mvc-music-store-part-7 Like instructed, I entered to ASP.NET Web Application
Following this tutorial (http://www.asp.net/mvc/tutorials/getting-started-with-ef-using-mvc/handling-concurrency-with-the-entity-framework-in-an-asp-net-mvc-application), I learned how to save data and do concurrency checks
I'm learning ASP.net MVC 3 with the music store tutorial--but translating the C# into
I am following the ASP.NET MVC 3 Music store application tutorial but I keep
I am following the Microsoft music store tutorial for asp.net mvc 3 using visual
What is the purpose of mocking? I have been following some ASP.NET MVC tutorials
I am following along with the music store example to try learn ASP.NET MVC.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.