/// <summary> /// This method will first fetch an employee and a manager and add them to the company. /// Then finally insert the new company into the SQLITE db. /// </summary> /// <param name="dbContext"></param> private static void CreateNewCompany(TestDatabaseContext dbContext) { Company company = new Company(); var matchedEmployee = (from a in dbContext.GetTable <Employee>() where a.EmployeeID == 4 select a).SingleOrDefault(); var matchedManager = (from a in dbContext.GetTable <Manager>() where a.ManagerRank == "Big Boss" select a).SingleOrDefault(); company.EmployeeID = matchedEmployee.EmployeeID; company.ManagerID = matchedManager.ManagerID; dbContext.Company.InsertOnSubmit(company); dbContext.SubmitChanges(); }
/// <summary> /// This method will fetch the entire Person Table using LINQ. /// </summary> /// <param name="dbContext"> Is the parameter for the dbConnection</param> /// <returns></returns> private static List <Person> GetPeopleList(TestDatabaseContext dbContext) { var q = from a in dbContext.GetTable <Person>() select a; var list = q.ToList(); return(list); }
private static IQueryable <Company> SelectAllCompanies(TestDatabaseContext dbContext) { return(from a in dbContext.GetTable <Company>() select a); }