|
using Microsoft.Data.Entity;
using
|
səhifə | 5/6 | tarix | 05.04.2022 | ölçüsü | 0,79 Mb. | | #54777 |
| Mavzu Web dasturlash Reja
using Microsoft.Data.Entity;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Linq;
namespace ContosoBooks.Models {
public static class SampleData {
public static void Initialize(IServiceProvider serviceProvider) {
var context = serviceProvider.GetService();
context.Database.Migrate();
if (!context.Book.Any()) {
var austen = context.Author.Add(
new Author { LastName = "Austen", FirstMidName = "Jane" }).Entity;
var dickens = context.Author.Add(
new Author { LastName = "Dickens", FirstMidName = "Charles" }).Entity;
var cervantes = context.Author.Add(
new Author { LastName = "Cervantes", FirstMidName = "Miguel" }).Entity;
context.Book.AddRange(
Dostları ilə paylaş: |
|
|