IBeepFormsHost and IBeepFormsBootstrapper interfaces -- the disciplined facade between BeepBlock and FormsManager with 40+ members for block registration, UoW queries, LOV operations, validation, and CRUD proxies
Namespace:TheTechIdea.Beep.Winform.Controls.Integrated.Forms.Contracts
Two interfaces define the contract between BeepBlock and BeepForms (the Coordinator host). The architecture follows a strict discipline:
IBeepFormsHost -- A facade that BeepBlock calls. Blocks must never dereference FormsManager directly; they must use only the proxy methods on this interface. This keeps the block-layer decoupled from the forms infrastructure.
IBeepFormsBootstrapper -- Initializes blocks with EntityStructure metadata from live datasources.
BeepBlock -> IBeepFormsHost (BeepForms) -> IUnitofWorksManager (FormsManager) -> IDataSource
^--- Block must ONLY call IBeepFormsHost, never dereference FormsManager
IBeepFormsHost: Identity & State
Member
Type
Description
FormName
string (get/set)
Forms host identifier
ActiveBlockName
string? (get)
Currently active block's name
FormsManager
IUnitofWorksManager? (get/set)
WARNING: BeepBlock must NOT call this. Use proxy methods only.
Definition
BeepFormsDefinition? (get/set)
Configuration definition for the forms host
ViewState
BeepFormsViewState (get)
Current display state of the forms host
Blocks
IReadOnlyList<IBeepBlockView> (get)
All registered block views
IBeepFormsHost: Events (11)
Event
Handler Type
Description
ActiveBlockChanged
EventHandler?
Active block switched (tab change, navigation)
FormsManagerChanged
EventHandler?
Manager reference replaced
ViewStateChanged
EventHandler?
View state changed (query/insert/edit modes)
BootstrapCompleted
EventHandler<BeepFormsBootstrapEventArgs>?
Phase 7D: async bootstrap finished. Args include success flag and error details.
TriggerExecuting
EventHandler<TriggerExecutingEventArgs>?
Before trigger execution (cancelable)
TriggerExecuted
EventHandler<TriggerExecutedEventArgs>?
After trigger execution completes
TriggerRegistered
EventHandler<TriggerRegisteredEventArgs>?
Trigger was registered for a block/event
TriggerUnregistered
EventHandler<TriggerUnregisteredEventArgs>?
Trigger was removed
TriggerChainCompleted
EventHandler<TriggerChainCompletedEventArgs>?
Full trigger chain execution completed
BlockUnitOfWorkActivity
EventHandler<BeepFormsUnitOfWorkEventArgs>?
UoW state change in a block (dirty, saved, rolled back)
Validate a record against block rules at a specific timing (BeforeSave, BeforeNavigation)
IsFieldQueryAllowed(string block, string field)
bool
Check if field can be queried
SaveBlockAsync(string block)
Task<bool>
Save current block's UoW changes
RollbackBlockAsync(string block)
Task<bool>
Rollback block's UoW changes
InsertBlockRecordAsync(string block)
Task<bool>
Insert a new record into the block
DeleteBlockCurrentRecordAsync(string block)
Task<bool>
Delete current record from the block
IBeepFormsBootstrapper
public interface IBeepFormsBootstrapper
{
Task<bool> BootstrapAsync(BeepForms forms,
CancellationToken cancellationToken = default);
// Populates BeepBlock instances with EntityStructure metadata
// from a live datasource. Iterates all blocks in the
// BeepFormsDefinition with valid ConnectionName + EntityName.
//
// Returns: true = all blocks populated,
// false = at least one block failed or was skipped.
// Implementations must not throw; swallow failures.
}
Code Examples
// Block registration
var host = (IBeepFormsHost)myBeepForms;
host.RegisterBlock(myBlockView);
host.TrySetActiveBlock("CustomerBlock");
// Query current state
var uow = host.GetBlockUnitOfWork("CustomerBlock");
var currentItem = host.GetCurrentBlockItem("CustomerBlock");
// LOV interaction
if (host.HasLov("CustomerBlock", "Country"))
{
var result = await host.ShowLovAsync(
"CustomerBlock", "Country");
if (result.Selected)
Console.WriteLine($"Selected: {result.Value}");
}
// Save and validate
var validation = host.ValidateBlockRecord("CustomerBlock",
myRecord, ValidationTiming.BeforeSave);
if (validation.IsValid)
await host.SaveBlockAsync("CustomerBlock");
// Bootstrap
var bootstrapper = new MyBootstrapper();
await bootstrapper.BootstrapAsync(myBeepForms);