What is the correct way to use Entity Framework as datasource for DataGridView?

前端 未结 2 1602
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-10 11:36

I tried setting DataSource via DataGridView Designer but it wasn\'t listed there and then I generated new datasource via wizard which generated DataSet.

But

2条回答
  •  渐次进展
    2020-12-10 12:29

    Don't know if it's the fastest method but it's the simpler:

    dataGridViewStudents.DataSource = schoolContext.Students.ToList();
    

提交回复
热议问题