0

I'm trying to access ObjectContext to be able to increase the CommandTimeout using WCF RIA / EF5

protected override MyEntities CreateDbContext()
{
    var dbContext = base.CreateDbContext();

    // returns a null ref
    // Get the ObjectContext related to this DbContext
    var objectContext = (this as IObjectContextAdapter).ObjectContext;            

    objectContext.CommandTimeout = 120;
    return dbContext;
}

This doesn't work.

Currently the EF timeout is 30secs.

4

1 回答 1

0

我可能得到了它:

 protected override MyEntities CreateDbContext()
        {
            var dbContext = base.CreateDbContext();

            // Get the ObjectContext related to this DbContext
            var objectContext = (dbContext as IObjectContextAdapter).ObjectContext;

            // Sets the command timeout for all the commands
            objectContext.CommandTimeout = 240;

            return dbContext;
        }
于 2013-07-01T14:03:28.620 回答