EntityFramework creates tables, UserContext tries to use wrong prefix

Girmaly669

New Member
On my hosting provider, Entity Framework is creating the tables for my simple membership correctly. They are being created with the db prefix being the name of the database:
5ltRi.jpg
When using my UserContext, it attempts to access [Dbo].UserProfile rather than [DB6002_chuck].UserProfile, thus I am getting this exception \[code\]System.Data.SqlClient.SqlException: Invalid object name 'dbo.UserProfile'. at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) \[/code\]What do I need to do to make sure that my UserContext uses the correct table that was created by EF?My context looks like this:\[code\]public class UsersContext : DbContext{ public UsersContext() : base("DefaultConnection") { } public DbSet<UserProfile> UserProfiles { get; set; }}[Table("UserProfile")]public class UserProfile{ [Key] [DatabaseGenerated(DatabaseGeneratedOption.Identity)] public int UserId { get; set; } public string UserName { get; set; }}\[/code\]
 
Back
Top