110,891
社区成员
发帖
与我相关
我的任务
分享
public class KTStoreModel : DbContext
{
public KTStoreModel()
: base("name=KTStoreModel")
{
}
public DbSet<Product> Product { get; set; }
}
public class Product
{
public int Id { get; set; }
public string Name { get; set; }
public int Price { get; set; }
public string Category { get; set; }
}
private void Button_Click(object sender, RoutedEventArgs e)
{
KTStoreModel model = new KTStoreModel();
IEnumerable<Product> rows = model.Product.Select(x => x);
int c = model.Product.Count();
MessageBox.Show(c.ToString());
}