1

i've created a default MVC4 Template Template with authorization. Now i like to add a model (TestModel) to my dbcontext.

public class UsersContext : DbContext
{
    public UsersContext()
        : base("DefaultConnection")
    {
    }

    public DbSet<UserProfile> UserProfiles { get; set; }
    public DbSet<TestModel> TestModel { get; set; }
}

After i changed the dbcontext i've to delete the database and change the name. Is there a more comfortable way ?

1 Answer 1

1

The context and the database don't always have to be the same name. You can define the name of your database in your connection string by using Initial Catalog=DbNameGoesHere. This way you can rename your context all you want and the database name is always the same.

Sign up to request clarification or add additional context in comments.

1 Comment

i'know its annoying trough

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.