如何计算linq中的DataContext.SubmitChanges到Sql [英] How to count DataContext.SubmitChanges in linq to Sql

查看:65
本文介绍了如何计算linq中的DataContext.SubmitChanges到Sql的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

伙计们,我想检查一下DataContext.SubmitChanges的进度,我的应用程序一次要向数据库中插入1000条记录,需要一两分钟的时间.因此,我想使用进度条向用户显示进度,但是我找不到返回此进度的方法,非常感谢您的帮助.谢谢

Hey guys, I''m looking to check the progress DataContext.SubmitChanges, my application is inserting 1000''s of records in to the database in one go and takes a minute or two. So I want to display to the user the progress using a progress bar but I can''t find a way to return this, any help is very much apreciated. Thanks

推荐答案

尝试一下:

Try this :

entity.Orders.Count(p => p.EntityState == System.Data.EntityState.Added);


这篇关于如何计算linq中的DataContext.SubmitChanges到Sql的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆