我想在 EF 中运行一个存储过程。我首先将过程添加到模型中并设置返回值。生成此代码:
public ObjectResult<Report3> SPSelectReport3(global::System.String stringWhereParameter, Nullable<global::System.Int32> pageIndex, Nullable<global::System.Int32> pageSize)
{
ObjectParameter stringWhereParameterParameter;
if (stringWhereParameter != null)
{
stringWhereParameterParameter = new ObjectParameter("StringWhereParameter", stringWhereParameter);
}
else
{
stringWhereParameterParameter = new ObjectParameter("StringWhereParameter", typeof(global::System.String));
}
ObjectParameter pageIndexParameter;
if (pageIndex.HasValue)
{
pageIndexParameter = new ObjectParameter("PageIndex", pageIndex);
}
else
{
pageIndexParameter = new ObjectParameter("PageIndex", typeof(global::System.Int32));
}
ObjectParameter pageSizeParameter;
if (pageSize.HasValue)
{
pageSizeParameter = new ObjectParameter("PageSize", pageSize);
}
else
{
pageSizeParameter = new ObjectParameter("PageSize", typeof(global::System.Int32));
}
// ((IObjectContextAdapter)this).ObjectContext.CommandTimeout = 999999;
return base.ExecuteFunction<Report3>("SPSelectReport3", stringWhereParameterParameter, pageIndexParameter, pageSizeParameter);
}
/// <summary>
/// No Metadata Documentation available.
/// </summary>
/// <param name="mergeOption"></param>
/// <param name="stringWhereParameter">No Metadata Documentation available.</param>
/// <param name="pageIndex">No Metadata Documentation available.</param>
/// <param name="pageSize">No Metadata Documentation available.</param>
public ObjectResult<Report3> SPSelectReport3(global::System.String stringWhereParameter, Nullable<global::System.Int32> pageIndex, Nullable<global::System.Int32> pageSize, MergeOption mergeOption)
{
ObjectParameter stringWhereParameterParameter;
if (stringWhereParameter != null)
{
stringWhereParameterParameter = new ObjectParameter("StringWhereParameter", stringWhereParameter);
}
else
{
stringWhereParameterParameter = new ObjectParameter("StringWhereParameter", typeof(global::System.String));
}
ObjectParameter pageIndexParameter;
if (pageIndex.HasValue)
{
pageIndexParameter = new ObjectParameter("PageIndex", pageIndex);
}
else
{
pageIndexParameter = new ObjectParameter("PageIndex", typeof(global::System.Int32));
}
ObjectParameter pageSizeParameter;
if (pageSize.HasValue)
{
pageSizeParameter = new ObjectParameter("PageSize", pageSize);
}
else
{
pageSizeParameter = new ObjectParameter("PageSize", typeof(global::System.Int32));
}
// ((IObjectContextAdapter)).ObjectContext.CommandTimeout = 180;
return base.ExecuteFunction<Report3>("SPSelectReport3", mergeOption, stringWhereParameterParameter, pageIndexParameter, pageSizeParameter);
}
但是当我运行代码时,我得到一个超时错误。如何在此代码中设置超时?