0

I have an existing database.I am using code first from existing database.I am able to add new column to an existing table using add-migration and update database command.

But when I want to generate new table using a class new table is not created. For example I want to create a new table LocaleResource.I have created a new class. I have fired add-migration LocaleResourceClass and then Update database command. But no new table is creating.I am using Entity Framework 6.1.

Please help me how to do that.

1 Answer 1

1

In order to have a migration created you have to add the new table to your context.

public virtual DbSet<LocalResource> LocalResources {get; set;}

Otherwise the migration macro does not know about your new table.

In case you are not sure where it was created just search your project for DbSet

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

Comments

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.