ReportViewer で使用される ObjectDataSource に CommandTimeout を設定したいと考えています。
部分クラスを作成しましたが、デバッグで TableAdapter をクリックしてプロパティを展開するまで、TableAdapter は null です。その後、TableAdapter は値を取得します。
コードは次のとおりです。
protected void ObjectDataSource2_ObjectCreated(object sender, ObjectDataSourceEventArgs e)
{
DataSet1TableAdapters.sp_SalesSummaryReportTableAdapter ta;
ta = (DataSet1TableAdapters.sp_SalesSummaryReportTableAdapter)e.ObjectInstance;
ta.SelectCommandTimeout = 0; //Here ta is null until I click on ta in debug and expand the values.
}
そして私の部分的なクラスコード:
public partial class sp_SalesSummaryReportTableAdapter
{
public int SelectCommandTimeout
{
set
{
if (this._commandCollection != null)
{
for (int i = 0; i < this._commandCollection.Length; i++)
{
if ((this._commandCollection[i] != null))
{
((System.Data.SqlClient.SqlCommand)
(this._commandCollection[i])).CommandTimeout = value;
}
}
}
}
}
}