Reputation: 1171
Legacy ASP.NET application uses a LinqDataSource to populate a GridView, but querying the SQL Server view is slow unless OPTION (USE HINT ('FORCE_LEGACY_CARDINALITY_ESTIMATION')) is added to the query.
<asp:LinqDataSource ID="MyDataSource" runat="server"
ContextTypeName="MyDataContext"
OrderBy="Column1, Column2"
TableName="MyTable"
Where="MyId == @Pid && Oid == @Oid">
<WhereParameters>
<asp:Parameter DefaultValue="1" Name="Pid" Type="Int32" />
<asp:Parameter DefaultValue="1" Name="Oid" Type="Int32" />
</WhereParameters>
</asp:LinqDataSource>
Is there any way to add an option/hint to a LinqDataSource?
Upvotes: 0
Views: 40