public static void InsertData(IServiceProvider serviceProvider) { using (var context = new InMemoryDBContext(serviceProvider.GetRequiredService <DbContextOptions <InMemoryDBContext> >())) { context.Companies.AddRange( new Company { Name = "Microsoft", Description = "Microsoft Corporation is an American multinational technology company with headquarters in Redmond, Washington. It develops, manufactures, licenses, supports, and sells computer software, consumer electronics, personal computers, and related services.", IsActive = true, WebSiteUrl = @"https://www.microsoft.com" }, new Company { Name = "Apple Inc.", Description = "Apple Inc. is an American multinational technology company headquartered in Cupertino, California, that designs, develops, and sells consumer electronics, computer software, and online services.", IsActive = true, WebSiteUrl = @"https://www.apple.com" }, new Company { Name = "Google", Description = "Google LLC is an American multinational technology company that specializes in Internet-related services and products, which include online advertising technologies, search engine, cloud computing, software, and hardware.", IsActive = true, WebSiteUrl = "https://www.google.com." }, new Company { Name = "Amazon", Description = "Amazon.com, Inc. , is an American multinational technology company based in Seattle, Washington, that focuses on e-commerce, cloud computing, digital streaming, and artificial intelligence.", IsActive = true, WebSiteUrl = "" }, new Company { Name = "Facebook", Description = "Facebook, Inc. is an American online social media and social networking service company based in Menlo Park, California", IsActive = true, WebSiteUrl = "https://www.facebook.com/" } ); context.SaveChanges(); } }
public CompaniesRepository(InMemoryDBContext context) { _context = context; }