I am working on the first EF Code site, and I wrote my classes and context class, the source of which is:
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Data.Entity; using MySite.SalesTool.Data.Entities; using System.Data.Entity.ModelConfiguration.Conventions; namespace MySite.SalesTool.Data { public class SalesToolEntities : DbContext { public DbSet<User> Users { get; set; } public DbSet<UserRole> UserRoles { get; set; } public DbSet<Job> Jobs { get; set; } public DbSet<JobAssigner> JobAssigners { get; set; } public DbSet<JobFile> JobFiles { get; set; } public DbSet<JobStatus> JobStatuses { get; set; } public DbSet<AssignedUser> AssignedUsers { get; set; } } }
The project builds fine, but when I go to start the site, the tables are not created in the database, and I get an error message indicating that the database cannot find any context object that I am trying to access and access, apparently , because at first the code does not generate any of the necessary tables.
Any ideas why it doesn't generate any of the tables at all and doesn't give me any error information?
asp.net-mvc entity-framework ef-code-first
Tim
source share