C # - EntityFramework | Database Comparison

3

I started using EF recently, so I do not have much knowledge about it.

I would like to know if I have a comparison of my class with the database, using EF.

Comparison example:

Employee Class has the following fields:

  

Code, Name, Zip, Phone, City.

In the database in the Employees table, you have the following fields:

  

Code, Name, Zip, Phone, City, State

I wanted an Entity routine that compared my Employees class to the Employees table, and I would return which fields the bank has, and which my class does not have, and vice versa (class owns, bank does not own ).

Do you know if it is possible to do this, or if EF only creates the database according to the mapping I did in my class?

    
asked by anonymous 15.06.2015 / 19:13

1 answer

3

We can use 2 strategies with EF: Code First and Database First .

Code-First

link

Db-First

link

I understand that you are developing an application that already has a database.

In this case you can use the Entity Framework Power Tools . This tool has an option for you to use reverse engineering, that is, from the database it creates the classes already with DataAnnotations .

Follow this link:

link

Sorry, I do not know of any tool that compares the database with your classes, but I think the proposed solution will help you.

    
15.06.2015 / 20:37