Hello I’m using a custom model to build home page data.
Here is the model.
public sealed class HomePageData : IBasePage
{
[JsonConverter(typeof(InvariantConverter))]
public string AppName { get; set; }
[JsonConverter(typeof(InvariantConverter))]
public string Title { get; set; }
[JsonConverter(typeof(InvariantConverter))]
public string Slug { get; set; }
[JsonConverter(typeof(InvariantConverter))]
public string ClanName { get; set; }
[JsonConverter(typeof(InvariantConverter))]
public string Slogan { get; set; }
[JsonConverter(typeof(InvariantConverter))]
public string ReadMoreText { get; set; }
[JsonConverter(typeof(InvariantConverter))]
public string HeroImage { get; set; }
[JsonConverter(typeof(InvariantConverter))]
public string CommunitiesTitle { get; set; }
[JsonConverter(typeof(InvariantConverter))]
public string CommunitiesHeader { get; set; }
[JsonConverter(typeof(InvariantConverter))]
public List<GameCommunity> Communities { get; set; }
[JsonConverter(typeof(InvariantConverter))]
public string SpotLightHeader { get; set; }
[JsonConverter(typeof(InvariantConverter))]
public string SpotlightDEscription { get; set; }
[JsonConverter(typeof(InvariantConverter))]
public MemberSpotlight MemberSpotlight { get; set; }
[JsonConverter(typeof(InvariantConverter))]
public string Subheader { get; set; }
[JsonConverter(typeof(InvariantConverter))]
public string WhyHeader { get; set; }
[JsonConverter(typeof(InvariantConverter))]
public List<CommunityBenefit> CommunityBenefits { get; set; }
}
var page = await pagesClient.GraphQlAsync<JToken>(query);
return page.ToObject<HomePage>();
When the controller gets the model I see this error in the watch window.
AppName = ‘page.AppName’ threw an exception of type ‘System.InvalidOperationException’
‘page.SchemaName’ threw an exception of type ‘System.InvalidOperationException’
'page.AppName' threw an exception of type 'System.InvalidOperationException'
at Squidex.ClientLibrary.Content`1[[Absolved.Models.Pages.HomePageData, Absolved, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].GetDetails()
at Squidex.ClientLibrary.Content`1[[Absolved.Models.Pages.HomePageData, Absolved, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].get_AppName()
'page.SchemaName' threw an exception of type 'System.InvalidOperationException'
" at Squidex.ClientLibrary.Content`1[[Absolved.Models.Pages.HomePageData,
Absolved, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].GetDetails()\r\n
at Squidex.ClientLibrary.Content`1[[Absolved.Models.Pages.HomePageData,
Absolved, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].get_SchemaName()"
@Sebastian
Could you please share the class as I tried to create my own class but issue is being inherited from Contentbase class - public abstract class ContentBase : Entity ?
@Sebastian
There is an issue comes up when I use the Entity object on the Page coming from here. With DataClass it works fine but that is not a project architecture. Entity Object is inherited from Content
if (!Links.TryGetValue(“self”, out var self))
{
throw new InvalidOperationException(“Content has no self link.”);
}