Flat Forms: Form Definition - ProCodersPtyLtd/MasterDetailsDataEntry GitHub Wiki

Idea

Form Definition is a low-code approach to build dynamic user interface without usage of html, css and javascript.

This low-code approach can be very useful for low budget projects or prototyping; it doesn't require extensive programming experience, and it can be used by citizen developers. However, projects with complex design and architecture can also benefit from dynamic SQL forms.

In a simple way to create UI edit form or list form developer needs to "define form" - peek Entity Framework (EF) entity and specify how each entity property should be rendered: hidden or visible, what type of control, editable or read-only, required or optional, etc. and all database manipulations will be done by Platz.SqlForms framework behind the scene.

For more complex scenarios developer can define validation logic, provide business rules, provide database queries by overriding default CRUD operations, and even use business objects instead of EF entities.

Definition

Typical form definition is very similar to a standard EF model definition (EF ModelBuilder, EntityTypeBuilder and PropertyBuilder) where for each entity property developer can supply a chain of methods that describe the property:

            builder.Entity<Course>(e =>
            {
                e.Property(p => p.CourseID).IsPrimaryKey().IsUnique(); 

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

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

Defining forms developer will be able to use Visual Studio intellisense, code will be type-safe and most of the errors will be found during compile-time.

List form

List form is a type of dynamic forms that is rendered as a table in UI page. The rendered table consists of columns (values from database) and context menu buttons, clicking on the buttons User will be redirected to another page, for example to edit page when User clicked "Edit" button.

To define list form developer needs to create a class inherited from DataServiceBase<TContext> and override Define method.

Edit form

Edit form is another type of dynamic forms that is used for adding, changing or deleting EF entity records to/from database. This form shows edit controls for each defined property and dialog buttons (Submit, Cancel, Delete, etc.) clicking on the buttons User initiates CRUD operation to database and in case of success User is redirected to another page, for example back to list page.

To define edit form developer should create a class inherited from DynamicEditFormBase<TContext> and override Define method.

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