Trying MVC on simple examples I've faced a problem with creating templated controller with reading and writing and views using Entity Framework.
I choose model class Album.cs
public class Album
{
public int AlbumId { get; set; }
public int GenreId { get; set; }
public int ArtistId { get; set; }
public string Title { get; set; }
public decimal Price { get; set; }
public string AlbumArtUrl { get; set; }
public Genre Genre { get; set; }
}
My data context is MusicStoreEntities:
public class MusicStoreEntities : DbContext
{
public DbSet<Album> Albums { get; set; }
public DbSet<Genre> Genres { get; set; }
}
The class Genres is
public class Genre
{
public int GenreId { get; set; }
public string Name { get; set; }
public string Description { get; set; }
public List<Album> Albums { get; set; }
}
The problem is that when I press the button "Add" in the dialog of adding new controller, the IDE throws th message-box with the text "Unable to restore metadata for (models_namespace).Album. Using the same DbCompiledModel to create contexts against different types of database servers is not supported. Instead, create a separate DbCompiledModel for each type of server being used".
Please, help to understand what's the problem and what it wants from me.
I use EF version 5 and MVC 4.</pre>