下面两段代码,你认为那一段写的更好?
下面2段代码的功能是一模一样的,但写的方式不一样。你更喜欢那一段呢?为什么?
代码1:
1 public ActionResult ApplicationDetails(long applicationId) 2 { 3 var model = new ApplicationDetailsViewModel(applicationId) 4 .BuildPhones() 5 .BuildEducationHistories() 6 .BuildReferences() 7 .BuildWorkHistories(); 8 return View("../EmailViewer/ApplicationDetails", model); 9 }
代码2:
1 public ActionResult ApplicationDetails2(long applicationId) 2 { 3 var model = new ApplicationDetailsViewModel(applicationId); 4 var builder = BuilderFactory.CreateBuilder<ApplicationDetailsViewModelBuilder>(); 5 builder.BuildPhones(model); 6 builder.BuildEducationHistories(model); 7 builder.BuildReferences(model); 8 builder.BuildWorkHistories(model); 9 return View("../EmailViewer/ApplicationDetails", model); 10 }