Create database in SQL Server and call it Company. Login is sa password: r00m215
Execute script company_sqlserver.sql that you could download from module web site that will create EMP and DEPT tables. These tables we will use to implement CRUD operations using Entity Framework.
Using examples specified below implement the following pages:
Page that will show all the employees
Page that will show all the employees filtered by Job
Page where you will be able to insert or update new employee
Page where you will be able to delete employee by EmpNo
Create tables that we used for Library case study in SQL Server DB and implement Lbrary system using Entity Framework.
Entity Framework Examples
Select
//getting list of objects using (var ctx = new ChinookEntities()) { var res = from e in ctx.Employees where e.City == city select e; return res.ToList(); }
//getting one object using (var ctx = new ChinookEntities()) { var res = from e in ctx.Employees where e.EmployeeId == id select e; return res.FirstOrDefault(); }
//alternative syntax using (var ctx = new ChinookEntities()) { var res = ctx.Employees.Where(e=>e.EmployeeId == id).FirstOrDefault(); return res; }
//get employees wth customers loaded using (var ctx = new ChinookEntities()) { var res = ctx.Employees
.Where(e => e.City == city).Include(e=>e.Customers).ToList(); return res; }
Insert
using (var ctx = new ChinookEntities()) { ctx.Genres.Add(g); ctx.SaveChanges(); }
Update using (var ctx = new ChinookEntities()) {