Execute the command: Enable-Migrations. A new class called Configuration appears under a new folder called Migrations. Go to this class and use the following code as an example to seed two tables called Sport and RaceType:
The first method, Seed which is overrided to use our own seed actions includes a call to an SQL Command, in order to delete the tables, and initialize the index counters. Following to a call to the method GetSports, which obtains data from the Sports List created bellow. For each element on this list we call the Add method.
To manually launch this seed you only need to use the command Update-Database in the previous shell.
No hay comentarios:
Publicar un comentario