Platz.SqlForms Flat Forms programming reference - ProCodersPtyLtd/MasterDetailsDataEntry GitHub Wiki

Installation

Platz.SqlForms framework is supposed to be installed using the NuGet package that can be found in Visual Studio Package Manager, the official link is: https://www.nuget.org/packages/Platz.SqlForms

Usage

To use Platz.SqlForms framework you will need to do these steps:

  1. Create a Dynamic Form definition - a class that is inherited from DynamicEditFormBase<TContext>
  2. Use razor component FormDynamicEditComponent on a Blazor page to render the created Dynamic Form definition
  3. For List Forms create a from definition inherited from DataServiceBase<TContext> and render it by FormDataServiceListComponent

Form Definition Example

using DemoSqlForms.Database.Model;
using Platz.SqlForms;

namespace DemoSqlForms.App.Forms
{
    public class CourseEditForm : DynamicEditFormBase<SchoolContext>
    {
        protected override void Define(DynamicFormBuilder builder)
        {
            builder.Entity<Course>(e =>
            {
                e.Property(p => p.CourseID).IsPrimaryKey().IsUnique(); 

                e.Property(p => p.Title).IsRequired();

                e.Property(p => p.Credits).IsRequired();

                e.DialogButton(ButtonActionTypes.Cancel).DialogButton(ButtonActionTypes.Submit);

                e.DialogButtonNavigation("CourseList", ButtonActionTypes.Cancel, ButtonActionTypes.Delete, ButtonActionTypes.Submit);
            });
        }
    }
}

Razor Page Example

@page "/CourseEdit/{CourseId:int}"
@page "/CourseEdit"

<h1>Course Edit</h1>

<FormDynamicEditComponent TForm="CourseEditForm" Id="@CourseId" />

@code {
    [Parameter]
    public int CourseId { get; set; }
}

Next Page: How to start

⚠️ **GitHub.com Fallback** ⚠️