可以写一个部分类
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; } }