public static void PlanDelivery() { Console.WriteLine("PlanDelivery"); Delivery deliveryToBePlanned = CreateDeliveryToTest(); //Create Unit Of Work var unitOfWork = new EntityFrameworkUnitOfWork(); //Start Transaction var transaction = _domainDbContext.Database.BeginTransaction(); unitOfWork.SetTransaction(transaction); try { //Instantiate the Domain Service var planDeliveryService = new PlanDeliveryService( unitOfWork, _deliveryRepository, _plannedDeliveryRepository); //Execute method. var ok = planDeliveryService.PlanDelivery(deliveryToBePlanned.Id, "10:00", 1); Console.WriteLine("Added Planned delivery"); } catch (EntityValidationException ex) { Console.ForegroundColor = ConsoleColor.Red; foreach (var validationError in ex.ValidationErrors) { Console.WriteLine(validationError); } Console.ForegroundColor = ConsoleColor.White; } }