I’m working on a custom module and I’m having a strange issue I’m probably overlooking
I have a CMSQueryDataSource that is creating a datasource from a custom query that pulls information from a custom table. I then use that data source and load it into a universal viewer with a hierarchical transformation.
In the viewer I have the ability to edit or delete records in that custom table. When I check the DB after making an edit or a delete, I can see the row changed however when the CMSQueryDataSource runs the query again it returns the same datasource as before without any of the changes that happened in the DB. I’m not sure if its some caching issue or something of that sort but I can’t seem to find a way for the CMSQueryDataSource to pull the most recent data every time.
Here’s an example of my method:
private void LoadGrid()
_dataSource.QueryName = "custom.pageType.GridListQuery";
_dataSource.OrderBy = "order by Level asc";
GroupedDataSource gpd = new GroupedDataSource(_dataSource.DataSource, "ParentID", "Level");
TransformationInfo ti = TransformationInfoProvider.GetTransformation("custom.pageType.GridListTransformation");
HierarchicalTransformations transformation = new HierarchicalTransformations("ItemID");
_universalViewer.RelationColumnID = "ItemID";
_universalViewer.Transformations = transformation;
_universalViewer.DataSource = gpd;
I'm not sure how _dataSource.ClearCache(); works, but looks like this is caching issue. Could you please verify that second load does not actually pulls data from database?
Have you tried to setup cache dependencies for the data source?
I have a feeling it doesn’t work the way we think it does haha
I’ll give a try to cached dependencies and reply back later
Please, sign in to be able to submit a new answer.