using (var context = new CompanyContext()) { var newCompany = new Company { Name = "Acme Inc.", Address = "123 Main St.", City = "Anytown", State = "CA", ZipCode = "12345" }; context.Companies.Add(newCompany); context.SaveChanges(); }
using (var context = new CompanyContext()) { var companies = context.Companies.ToList(); foreach (var company in companies) { Console.WriteLine(company.Name); } }In these examples, the package library being used is Entity Framework, which simplifies the process of connecting to a database and performing CRUD operations.