I have a repository file in which we have created object context of entity type and not of ObjectContext
class type
public class ShopRepository : GenericRepository<tbl_Shop>
{
// Entity Framework context to the database
private DBEntities _contextObject;
public ShopRepository(DBEntities context)
: base(context)
{
this._contextObject = context;
}
}
I need to set command timeout property. Can someone help me
You can access to the DbContext
command timeout through the CommandTimeout
property of your ObjectContext
like below:
((IObjectContextAdapter)context).ObjectContext.CommandTimeout
So if you want to set it in your ShopRepository
ctor just do this:
public ShopRepository(DBEntities context)
: base(context)
{
((IObjectContextAdapter)context).ObjectContext.CommandTimeout = your_value_here;
this._contextObject = context;
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.