我已经从 db 表中填充了数据读取器,并且我有类似的类
public class CandidateApplication
{
public string EmailID { get; set; }
public string Name { get; set; }
public string PhoneNo { get; set; }
public string CurrentLocation { get; set; }
public string PreferredWorkLocation { get; set; }
public int RoleApplingFor { get; set; }
public string CurrentJobTitle { get; set; }
public int EducationLevel { get; set; }
public decimal SalaryExpected { get; set; }
public string AvailableTime { get; set; }
public int AdvertID { get; set; }
public bool SignForAlert { get; set; }
public string CVInText { get; set; }
public string CVFileName { get; set; }
public bool IsDownloaded { get; set; }
public string specialization { get; set; }
public bool isallocated { get; set; }
public int id { get; set; }
public string AdvertAdditionalInfo { get; set; }
}
我可以循环填充上面的类。我们可以在数据阅读器中迭代并填充类,但我想知道是否有任何捷径可以从数据阅读器中填充类。
如果从数据读取器到类可以进行数据反序列化,那么还要告诉我类中是否有少数字段在数据读取器中不存在,那么如何处理这种情况。