Skip to content
avanwaas edited this page Mar 9, 2023 · 5 revisions

Install code generator

dotnet tool install -g --add-source https://api.nuget.org/v3/index.json --ignore-failed-sources Enigmatry.Entry.CodeGeneration.Tools

Add package to project

dotnet add package Enigmatry.Entry.CodeGeneration.Configuration

Create forms and tables configurations

public class Project
{
    public int Id { get; set; }
    public string Name { get; set; }
}

public class ProjectConfiguration : IFormComponentConfiguration<Project>
{
    public void Configure(FormComponentBuilder<Project> builder)
    {
        _ = builder
            .Component()
            .IncludeUnconfiguredProperties(false)
            .HasName("ProjectEdit")
            .BelongsToFeature("Project");

        _ = builder.InputFormControl(x => x.Name)
            .WithLabel("Project name");
    }
}

Run the code generator

entry-codegen --source-assembly .\Customer.Project.CodeGeneration.Setup\bin\Debug\net6.0\Customer.Project.CodeGeneration.Setup.dll --destination-directory .\customer-project-app\src\app\features