Question

If I had a viewmodel that looked something like this

public class AddressViewModel
{
   public int AddressID {get;set;}
   public string Street {get;set;}
   public string Town {get;set;}
   public SelectList Countries { get; set; }

}

How would I go about populating this?

Would it be 2 queries to the database, 1 to populate the address info and another to return all countries into the SelectList?

Was it helpful?

Solution

I think so yes, maybe even cache it if the list values don't change.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top