Squidex.ClientLibrary currently has this structure for each schema:
public sealed class BlogPostData
{
// Squidex delivers hash maps for each field, but the
// InvariantConverter helps to simplify the model.
[JsonConverter(typeof(InvariantConverter))]
public string Title { get; set; }
[JsonConverter(typeof(InvariantConverter))]
public string Slug { get; set; }
// For localizable fields you can use dictionaries.
public Dictionary<string, string> Text { get; set; }
}
public sealed class BlogPost : SquidexEntityBase<BlogPostData>
{
}
var client = clientManager.GetClient<BlogPost, BlogPostData>("posts");
I think that instead of using two classes (of which one is empty), we can simplify the classes to the following:
public class FlatSM : SquidexEntityBase<FlatSM>
{
}
I would also suggest to remove the schema name from the GetClient() call and move it into an attribute on the data class. Therefore, we don’t need to type use name of schema every time we instantiate the ClientManager for the schema.
In summary, I’m suggesting something like this:
[Schema(Name="posts")]
public sealed class BlogPost : SquidexEntityBase<BlogPostData>
{
}
okay, forget about the attribute. I just noticed that you still need the name of the content as parameter to specify which content entity you want to update.
Thanks for your explanation! Maybe you can add a couple of sentences to the documentation of Squidex.ClientLibrary that outline why there are two classes
Unfortunately, no I haven’t found any improvement as of yet. We experimented a lot with referenced items and ran into other problems / inconveniences for which we’ll probably open another feature request in the next couple of days :-/