Introduction
UI Metadata Framework is a metadata-driven approach to building user interfaces. Instead of manually creating UI components, you define C# classes with attributes, and the framework automatically generates metadata that client applications use to render the interface.Core Architecture
The framework follows a client-server protocol with metadata as the contract between them:The Flow
- Server-Side Definition: You define forms using C# classes decorated with attributes
- Metadata Generation: The
MetadataBinderuses reflection to scan your classes and generate metadata - JSON Serialization: Metadata is serialized to JSON and sent to the client
- Client Rendering: The client reads the metadata and dynamically renders the appropriate UI components
The framework is client-agnostic. Any client that can parse JSON and render components based on metadata can work with the framework.
Three Core Concepts
The framework is built around three fundamental concepts:1. Forms
Forms are the top-level containers that define complete user interactions. Each form has:- Input fields (what the user provides)
- Output fields (what the server returns)
- Metadata properties (label, behavior, etc.)
2. Input Fields
Input fields represent data that users provide. They are decorated withInputFieldAttribute and support validation, ordering, and visibility control.
3. Output Fields
Output fields represent data returned from the server. They are decorated withOutputFieldAttribute and control how responses are displayed.
Component Binding System
The framework maps C# types to UI components using the ComponentBinding system:stringproperties → render as"text"input components- The component belongs to the
Inputcategory - No custom metadata factory is needed
You can create custom bindings to map any C# type to any client-side component. This makes the framework highly extensible.
Metadata Binder
TheMetadataBinder is the heart of the framework. It:
- Registers assemblies containing forms and components
- Scans for attributes using reflection
- Builds metadata from the attributes and type information
- Manages bindings between server types and client components
Metadata Categories
The framework organizes components into categories:- FieldCollection: Manages component bindings for that category
- Attribute types:
InputFieldAttributevsOutputFieldAttribute - Metadata factories: Generate category-specific metadata
Key Benefits
Type Safety
Define your UI contract in strongly-typed C# with compile-time validation
Client Agnostic
Support multiple client implementations (web, mobile, desktop) from a single backend
Reduced Boilerplate
Attributes replace repetitive UI code - the framework handles the rest
Extensible
Create custom attributes, components, and metadata factories for any use case
Form Lifecycle
Understanding the lifecycle helps you leverage the framework effectively:- Registration: Forms are registered with
FormRegister - Metadata Request: Client requests form metadata by form ID
- Metadata Response: Server returns JSON metadata describing the form
- User Interaction: Client renders UI and user fills in input fields
- Form Submission: Client sends input data to server
- Processing: Server executes form handler logic
- Response: Server returns output data with response metadata
- Rendering: Client renders the response based on metadata
Next Steps
Forms
Deep dive into form creation and configuration
Input Fields
Learn about input field attributes and validation
Output Fields
Understand output field configuration and rendering
Metadata Binding
Explore how reflection and binding work