diff --git a/App/Program.cs b/App/Program.cs index 44c4a99..66a25c3 100644 --- a/App/Program.cs +++ b/App/Program.cs @@ -14,6 +14,7 @@ using (var context = new LibraryContext()) Console.WriteLine("Insertion\n"); books = await myStub.booksStub(); + persons = await myStub.personsStub(); // Ajoute chaque person à la base de données de manière asynchrone foreach (var person in persons) @@ -21,6 +22,7 @@ using (var context = new LibraryContext()) await context.PersonsSet.AddAsync(person); } + await context.SaveChangesAsync(); // Ajoute chaque livre à la base de données de manière asynchrone foreach (var book in books) diff --git a/App/Test.Librairy.db b/App/Test.Librairy.db deleted file mode 100644 index e69de29..0000000 diff --git a/StubContext/StubContext.cs b/StubContext/StubContext.cs index 6dc4e90..01d3402 100644 --- a/StubContext/StubContext.cs +++ b/StubContext/StubContext.cs @@ -22,7 +22,6 @@ namespace StubbedContextLib Author = "Lechardeur", Title = "Comment pécho 100% garanti", Isbn = "696969a", - PersonEntityId = 1, }; BookEntity book2 = new BookEntity @@ -30,7 +29,8 @@ namespace StubbedContextLib Id = 2, Author = "Vianney", Title = "Gros", - Isbn = "0015150" + Isbn = "0015150", + PersonEntityId = 1, }; BookEntity book3 = new BookEntity @@ -38,7 +38,8 @@ namespace StubbedContextLib Id = 3, Author = "Khéna", Title = "Khéna; un homme, un livre", - Isbn = "666666b" + Isbn = "666666b", + PersonEntityId = 1, }; //Ajout des livres