ENTITY FRAMEWORK - add-Migration New Project without renaming old tables

Asked

Viewed 97 times

1

I want to share a database with some projects.

I’ve already done the first project with the bank and it’s okay. I copied the project to create another similar one, changed the initial prefix of the tables Ex: project1_client, project2_client and then the problem is happening. When generating the add-Migration in the new project he is suggesting renaming the tables of the old project.

How can I distinctly work the add-Migration on projects?

1 answer

0

Use a Tableattribute [Table("NomeTabela")]

@using System.ComponentModel.DataAnnotations.Schema;

[Table("NomeTabela")]
public class NomeClasse
{
    public int ID { get; set; }

    public string Name { get; set; }    
}

It is responsible for mapping your entity to the table with the specified name.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.