开发者

PetaPoco queries in a ViewModel

开发者 https://www.devze.com 2023-03-07 07:20 出处:网络
If I had a viewmodel that looked something like this public class AddressViewModel { public int AddressID {get;set;}

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;开发者_Python百科 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?


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

0

精彩评论

暂无评论...
验证码 换一张
取 消