[ ] Regression (a behavior that stopped working in a new release)
[x] Bug report
[ ] Performance issue
[ ] Documentation issue or request
Current behavior
I have defined a schema called Accessories. This schema then has a relationship field called Subcomponents, which is a reference back to the Accessories schema. Everything works fine as far as setting this up and setting up relationships through the Squidex portal, however when fetching the accessories items through the Squidex ClientLibrary with C#, The subcomponents property is always empty.
Expected behavior
The subcomponents property should be filled with a List of ids of the related items.
Minimal reproduction of the problem
Have a table with a relationship to itself and see if you can get the related items to load using the ClientLibrary
[KeepCasing]
public sealed class AccessoryData
{
[JsonConverter(typeof(InvariantConverter))]
public string PartNumber { get; set; }
[JsonConverter(typeof(InvariantConverter))]
public string Title { get; set; }
[JsonConverter(typeof(InvariantConverter))]
public List<string> Subcomponents { get; set; }
}
public sealed class SquidexAccessory : SquidexEntityBase<AccessoryData>
{
}
private async Task<bool> LoadData()
{
var accessoryClient = ClientManager.GetClient<SquidexAccessory, AccessoryData>("accessories");
var accessories = await accessoryClient.GetAsync();
foreach (var accessory in accessories.Items)
{
if (accessory.Data.Subcomponents != null && accessory.Data.Subcomponents.Count > 0)
var intCount = accessory.Data.Subcomponents.Count; //This is never more than 0
}
}
Sebastian, I think you are right, the references are unpublished because these were created manually where the rest of the data was created with an import process. I will publish now and let you know if any further problems. Sorry if I wasted your time.