kontent-ai / model-generator-net

Kontent.ai .NET model generator.
https://www.nuget.org/packages/Kontent.Ai.ModelGenerator
MIT License
17 stars 19 forks source link

New Class Format for Management API v2 #112

Closed Simply007 closed 2 years ago

Simply007 commented 3 years ago

Motivation

Related to https://github.com/Kentico/kontent-management-sdk-net/pull/67

As a part of the upgrade, we decided to:

Proposed solution

Example of the mode would looks like that:

The name of the attributes might be a subject of change

using System;
using Kentico.Kontent.Management.Models.Assets;
using Kentico.Kontent.Management.Models.Items;
using Kentico.Kontent.Management.Models.Items.Elements;
using Kentico.Kontent.Management.Modules.ModelBuilders;
using Newtonsoft.Json;

namespace KenticoKontentModels
{
    public partial class MyContentType
    {
        [JsonProperty("text")]
        [KontentElementId("77108990-3c30-5ffb-8dcd-8eb85fc52cb1")]
        public TextElement Text { get; set; }
    }
}

Additional context

Don't forget about the docs, but wait for the initial implementation review so that we don't need to rewrite documentation multiple times.