DP_Provice { public int proviceID { get; set; } public string ProviceName { get; set; } public int ProviceNode { get; set; } public virtual List}
public class DP_City { public int CityNode { get; set; } public string CityName { get; set; } public string ProviceNode { get; set; }
}
對以上涉及的實體類別予以賦值,暫時使用一個靜態類別初始化簡單資料: 複製程式碼
程式碼如下:
public static class DPDataSource { public static List { List source = new List { new DP_Provice{ ProviceNode=1, ProviceName="北京", citySource=new List{ new DP_City{ CityNode=11, CityName="北京海淀" }, new DP_City{ CityNode=12,CityName="北京西城" } }}, new DP_Provice{ ProviceNode=2, ProviceName="山東", citySource=new List{ new DP_City{ CityNode=21, CityName="濟南" }, CityNode=21, CityName="濟南" }, }, new DP_City{ CityNode=22,CityName="德州" } }}, new DP_Provice{ ProviceNode=3, ProviceName="河北", citySource=new List{ new DP_City{ CityNode=31, CityName="石家莊" }, new DP_City{ CityNode=32,CityName="衡水" } }} }