मेरे हालिया प्रोजेक्ट में जो Asp.net एमवीसी 2 का उपयोग कर रहा है, हमने पाया कि डिस्प्लेफ़ोर में प्रदर्शन समस्या है। मुझे यकीन नहीं है कि यह वास्तविक मुद्दा है या मुझे कुछ याद आया?Asp.net एमवीसी 2 प्रदर्शन प्रदर्शन प्रदर्शन समस्या?
मुझे आशा है कि कुछ एएसपीनेट एमवीसी गुरु मुझे यह समझा सकते हैं। :)
मॉडल।
public class Customer
{
public int CustomerId { get; set; }
public string Name { get; set; }
public string Address { get; set; }
public string EmailAddress { get; set; }
public static IEnumerable<Customer> GetCustomers()
{
for (int i = 0; i < 1000; i++)
{
var cust = new Customer()
{
CustomerId = i + 1,
Name = "Name - " + (i + 1),
Address = "Somewhere in the Earth...",
EmailAddress = "customerABC"
};
yield return cust;
}
}
}
नियंत्रक
public ActionResult V1()
{
return View(Customer.GetCustomers());
}
public ActionResult V2()
{
return View(Customer.GetCustomers());
}
V1
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<Customer>>" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
V1
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<h2>V1</h2>
<table>
<%foreach (var cust in this.Model)
{%>
<%= Html.DisplayFor(m => cust) %>
<%} %>
</table>
</asp:Content>
और खाका
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<Customer>" %>
<tr>
<td><%= this.Model.CustomerId %></td>
<td><%= this.Model.Name %></td>
<td><%= this.Model.Address %></td>
<td><%= this.Model.EmailAddress %></td>
</tr>
V2 (कोई प्रदर्शन मुद्दा)
है (प्रदर्शन मुद्दा है)<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<Customer>>" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
V2
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<h2>V2</h2>
<table>
<%foreach (var cust in this.Model)
{%>
<tr>
<td><%= cust.CustomerId%></td>
<td><%= cust.Name%></td>
<td><%= cust.Address%></td>
<td><%= cust.EmailAddress%></td>
</tr>
<%} %>
</table>
</asp:Content>
मैं V1 और V2 के बीच प्रदर्शन अंतर को आसानी से देख सकता हूं।
EDIT: जब मैं अपने स्थानीय आईआईएस 7 (रिलीज संस्करण के साथ) पर तैनात करता हूं और यह (वी 1) बहुत तेज़ हो जाता है। मुद्दा हल हो गया है, लेकिन मैं अभी भी कारण जानना चाहता हूं। :)
धन्यवाद,
सो मो
धन्यवाद! मैंने डीबग को झूठ में बदल दिया और प्रदर्शन उस पर वापस चला गया जिसकी मुझे उम्मीद थी ... – bytebender