开发者

PetaPoco queries in a ViewModel

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜