GetAsync in Client Library no longer supports HashSet parameter

I have…

I’m submitting a…

  • [x] Regression (a behavior that stopped working in a new release)
  • [ ] Bug report
  • [ ] Performance issue
  • [ ] Documentation issue or request

Current behavior

I have been using a Contents Client to retrieve multiple menus. The GetAsync method on that client no longer supports a HashSet to retrieve multiple items from a list of id’s.

var hs = new HashSet<string>(Ids);
var menuClient = CreateContentsClient<DynamicContent, DynamicData>("[schema]");
var menus = await menuClient.GetAsync(hs, ctx);

Perhaps this is bad design to rely on the ids, but I would like to not refactor at this point.

Expected behavior

Pass in a HashSet of string Ids and return the result.

Minimal reproduction of the problem

Environment

App Name:

  • [ ] Self hosted with docker
  • [ ] Self hosted with IIS
  • [ ] Self hosted with other version
  • [ x] Cloud version

Version: [VERSION]

Browser:

  • [ ] Chrome (desktop)
  • [ ] Chrome (Android)
  • [ ] Chrome (iOS)
  • [ ] Firefox
  • [ ] Safari (desktop)
  • [ ] Safari (iOS)
  • [ ] IE
  • [ ] Edge

Others:

Hi,

there was a design issue in the SDK, because the contents client - even though it was created for a single schema - was also used to make updates and queries across schemas.

Therefore, there is a new IContentsSharedClient now, which can be created with CreateSharedContentsClient

2 Likes

In case it helps we recently went through the same change for dynamic queries, so using the Squidex.ClientLibrary we have gone from:

var dynamicContentsClient = clientManager.CreateDynamicContentsClient("any_schema");
IContentsClient<DynamicContent, DynamicData> client;
var content = await client.GetAsync(new HashSet<string>(referenceIds));

To:

var dynamicContentsClient = clientManager.CreateSharedDynamicContentsClient();
IContentsSharedClient<DynamicContent, DynamicData> client;
var content = await client.GetAsync(referenceIds.ToHashSet());

At first we did not change our DI to use IContentsSharedClient so were having issues trying to specify an Ids parameter.

2 Likes

Thanks for your help!