我正在使用 asp.net 2.0。我正在使用声明性数据源。对于后面代码中的某些内容,我想访问 Foo.Bar 返回的对象(在下面的示例中)。系统正在缓存它,所以我应该能够访问该版本,而不必重新调用 Foo.Bar()。我该怎么做呢?
<asp:ObjectDataSource ID="MyLuckDataSource1" runat="server"
TypeName="Foo.Bar" SelectMethod="GetMoreFoo"
CacheDuration="Infinite" CacheExpirationPolicy="Sliding"
EnableCaching="True">
<SelectParameters>
<asp:ControlParameter ControlID="BarID" Name="bar_code" Type="String" Direction="Input" DefaultValue="1011" />
</SelectParameters>
</asp:ObjectDataSource>
<asp:GridView ID="GridView1" runat="server" runat="server" DataSourceID="MyLuckDataSource1" ...