Hi,
I can override the following methods in my custom DataAccessAdapter to modify the generated SQL:
protected override void OnFetchEntity(IRetrievalQuery selectQuery, IEntityFields2 fieldsToFetch)
{
selectQuery.Command.CommandText = RewriteQuery(selectQuery);
base.OnFetchEntity(selectQuery, fieldsToFetch);
}
protected override void OnFetchTypedList(IRetrievalQuery selectQuery, IEntityFields2 fieldCollectionToFetch, DataTable dataTableToFill)
{
selectQuery.Command.CommandText = RewriteQuery(selectQuery);
base.OnFetchTypedList(selectQuery, fieldCollectionToFetch, dataTableToFill);
}
protected override void OnFetchTypedView(IRetrievalQuery selectQuery, IEntityFields2 fieldCollectionToFetch, DataTable dataTableToFill)
{
selectQuery.Command.CommandText = RewriteQuery(selectQuery);
base.OnFetchTypedList(selectQuery, fieldCollectionToFetch, dataTableToFill);
}
protected override void OnFetchEntityCollection(IRetrievalQuery selectQuery, IEntityCollection2 entityCollectionToFetch)
{
selectQuery.Command.CommandText = RewriteQuery(selectQuery);
base.OnFetchEntityCollection(selectQuery, entityCollectionToFetch);
}
This works in LINQ for the ToList() method call, but what event do I override to modify the generated SQL sor the LINQ Count() method call.