Beispiel #1
0
 public static EmployeeViewModel Map(NorthwindEmployee obj)
 {
     return(new EmployeeViewModel
     {
         EmployeeId = obj.EmployeeId,
         FirstName = obj.FirstName,
         HomePhone = obj.HomePhone,
         LastName = obj.LastName,
         Title = obj.Title
     });
 }
Beispiel #2
0
        private static void CreateDatabase()
        {
            using (Context.Enter("Northwind"))
            {
                new SchemaExport(IoC.Resolve <Configuration>()).Create(true, true);

                using (UnitOfWork.Start())
                {
                    NorthwindEmployee emp = new NorthwindEmployee();
                    emp.HourlySalary  = 25;
                    emp.Name          = "Northwind Empl";
                    emp.OvertimeBonus = 150;
                    emp.Title         = "Mr.";
                    Repository <NorthwindEmployee> .Save(emp);

                    UnitOfWork.Current.TransactionalFlush();
                }
            }

            using (Context.Enter("Southsand"))
            {
                new SchemaExport(IoC.Resolve <Configuration>()).Create(true, true);

                using (UnitOfWork.Start())
                {
                    SouthsandEmployee emp = new SouthsandEmployee();
                    emp.GlobalSalary         = 2500;
                    emp.Name                 = "Southsand Empl";
                    emp.OvertimeHourlySalary = 30;
                    emp.Title                = "Mr.";
                    Repository <SouthsandEmployee> .Save(emp);

                    UnitOfWork.Current.TransactionalFlush();
                }
            }
        }