Created
June 14, 2018 09:44
-
-
Save danielplawgo/f14942396e704203f68165de1e17e381 to your computer and use it in GitHub Desktop.
MiniProfiler
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@MiniProfiler.RenderIncludes() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public virtual ActionResult Index2() | |
{ | |
using (MiniProfiler.Current.Step("Index2 action")) | |
{ | |
IEnumerable<UserViewModel> viewModels; | |
var models = db.Users.ToList(); | |
using (MiniProfiler.Current.Step("Mapping with automapper")) | |
{ | |
viewModels = Mapper.Map<List<UserViewModel>>(models); | |
} | |
return View(viewModels); | |
} | |
} | |
public virtual ActionResult Index3() | |
{ | |
using (MiniProfiler.Current.Step("Index3 action")) | |
{ | |
IEnumerable<UserViewModel> viewModels; | |
var models = db.Users.ToList(); | |
using (MiniProfiler.Current.Step("Mapping without automapper")) | |
{ | |
viewModels = models.Select(u => new UserViewModel() | |
{ | |
Id = u.Id, | |
Email = u.Email, | |
FirstName = u.FirstName, | |
LastName = u.LastName, | |
CreateInvoice = u.CreateInvoice, | |
UserName = u.UserName, | |
Nip = u.Nip | |
}).ToList(); | |
} | |
return View(Views.Index2, viewModels); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<add name="MiniProfiler" path="mini-profiler-resources/*" verb="*" type="System.Web.Routing.UrlRoutingModule" resourceType="Unspecified" preCondition="integratedMode" /> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment