خرید بک لینک

Vote count: 0

So I have a controller - TestController - with an Index method. A view - Index -, and a ViewModel - IndexViewModel.

The Index method gets a list of an object - TestObject - from a database which is then passed to the ViewModel to be displayed in the Index view.

It takes about 500ms to obtain the list of TestObject, but when I try to display all of the items in the view, it takes upwards of 10-15 seconds. Which leads me to believe that if nothing is wrong with my LINQ query and backend, that the view rendering is what's holding it up.

Index Method

[HttpGet]
public ActionResult Index()
{
   List<TestObject> testObjects = _myRepository.GetTestObjects();
   retu View(new IndexViewModel(_myRepository, testObjects));
}

IndexViewModel

public List<TestObject> TestObjects { get; set; }

public IndexViewModel() { }

public IndexViewModel(IMyRepository myRepository, List<TestObject>)
{
   TestObjects = testObjects;
}

Index View

<% if (Model.TestObjects != null && Model.TestObjects.Count() > 0) { %>
    <% Html.RenderPartial("TestObjectList", Model.TestObjects ); %>
<% }

Anyone have any ideas?

asked 1 min ago

برچسب: نویسنده: استخدام کار تاريخ: شنبه 25 ارديبهشت 1395 ساعت: 2:17

صفحه بندی