I am working on an internal message system. I have the mvc mini profiler hooked up, and it is showing me some statements are executed twice, and I can t figure out why,
我的控制者就像你能够做到的那样简单:
var db = MessagingDataContext.Get();
return db.Posts.OrderByDescending(p => p.DatePosted).Skip(pagenumber * pagesize).Take(pagesize);
我的看法同样简单(M_Layout网页有其他标记):
@foreach (var post in Model)
{
<div class="post">
<p>
@Html.ActionLink(post.Title, "View", "Posts", new { postid = post.Id}) by @post.User.Name
</p>
</div>
}
So why would get_User be executed twice?