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?
