I have a database (SQL-Server); if I connect to it, will I still have to create EF classes and use a migration ?
I have a database (SQL-Server); if I connect to it, will I still have to create EF classes and use a migration ?
Good afternoon, the usability of EF with migrations goes from its implementation. Home You can simply connect to the database and use it as it is. If you want to use migrations you should do your implementation according to the documentation and tutorials spread over the internet, so when you generate a migration bank it will be based on the classes mapped with EF, and your already created bank will suffer only the divergent changes of it made in the own migrations.
So let's say your bank has the Person table with the Name and Age Home The class in the code would look like:
class Pessoa {
public string Nome { get; set;}
public int Idade { get; set;}
}
If you run a new migration, a database with this table will be created as it is in the Code First . If you put an extra field in the code and run the migration it should update any existing database as well.
This was a theoretical explanation of the migration and its behavior, to implement it in that way consult other materials.