我有两节课。产品和颜色。如何访问 ProductColor(name,id) 示例:
public class tblColor
{
public int Id { get; set; }
public string ColorName { get; set; }
}
public class Urun
{
public int ProductId { get; set; }
public string ProductName { get; set; }
public tblRenk ProductColor { get; set; }
}
while (dr.Read())
{
products.Add(new Product()
{
ProductId = Convert.ToInt32(dr["id"].ToString()),
ProductName = dr["ProdName"].ToString(),
?????? ProductColor = dr["ColName"].ToString()
});
}