给Entity Framework添加执行的超时时间

可以写一个部分类

public partial class eBuulMCEntities 

{ 

    public eBuulMCEntities(int? commandTimeout)  : base("name=eBuulMCEntities")       

    {             // Get the ObjectContext related to this DbContext             

                 var objectContext = (this as IObjectContextAdapter).ObjectContext; 

                 // Sets the command timeout for all the commands             

                 objectContext.CommandTimeout = commandTimeout;      

     }  

} 

 

posted @ 2013-01-18 14:00  学亮  阅读(2013)  评论(0编辑  收藏  举报