Entity framework practices & issues

dbcontext.Entry performance issue:very slow

The DbContext object has sevaral thansands of entities and method call to Entry is very slow ( about 90ms).
Context.Entry() calls DetectChanges() that depends on number of objects in context and could be very slow. In your case you could replace with faster version ((IObjectContextAdapter) ctx).ObjectContext.ObjectStateManager.GetObjectStateEntry(obj);
1. 直接使用dbctx.Entry,慢,很慢,没有等到最终执行完成就终止它了。
2. 使用ObjectContex.ObjectStateManager.GetObjectStateEntry方法,加快不少,500多秒。
3. 每200-300个Entity就重新实例化一个DbContext(不使用相关Entry方法),执行时间少于70秒。