# Create Instance — bind connections at creation (design) **Date:** 2026-08-21 · **Status:** **implemented** 2026-08-21 — plan `docs/plans/2026-08-21-create-instance-bindings.md` **Mockup:** Claude artifact "Create Instance Bindings" (https://claude.ai/code/artifact/125dc749-c923-4977-a02a-eeac826e6f26) **Builds on:** `docs/plans/2026-08-20-grouped-connection-bindings-design.md` (Configure page groups, `BindingGroupBuilder`, per-module Object apply) ## 1. Problem `/deployment/instances/create` stops at Name / Template / Site / Area. The operator then has to find the new instance in Topology, open Configure, and bind every module group before the first Deploy — for a composed template like the MES Line Controller that is 8 groups / 270 rows, and the most common question at creation is exactly "which MxAccess object (or OPC UA node) does this instance hang off?". The answer should be given at creation, in the same shape the Configure page now uses. ## 2. Decisions (made 2026-08-21) | Decision | Choice | Alternatives considered | |---|---|---| | Shape | **Inline bindings card** on the create page — one row per module group (connection, Object, Browse…), with a "Bind all to" root picker; per-member editing stays on Configure. | Two-step wizard with the full grouped table (more screen, duplicates Configure); create-then-redirect to Configure with a banner (no new UI, but still two places). | | What Browse… picks | **The object node.** Selecting an `Object` node writes its id into the group's Object box; members become `.` via the existing `ApplyObject`. Picking a Variable is still allowed; the page strips the member tail. | Leaf-only selection + inference (works today, but non-obvious). | | After Create | **Land on the new instance's Configure page** with a "created, N bound" notice, so Test Bindings / Deploy are one click away. | Back to Topology (today). | ## 3. Design ### 3.1 Preview flatten (DeploymentManager, additive) The Configure page gets its rows from `IFlatteningPipeline.FlattenAndValidateAsync(instanceId)`, which loads the instance from the DB. At creation there is no row yet, but `FlatteningService.Flatten(Instance, chain, compositionMap, composedChains, dataConnections)` takes an in-memory `Instance`. Add ```csharp Task> PreviewAsync(int templateId, int siteId, CancellationToken ct = default); ``` to `IFlatteningPipeline`, implemented in `FlatteningPipeline` by factoring the chain/composition loading out of `FlattenAndValidateAsync` into a private helper and calling `Flatten` with an unsaved `new Instance { TemplateId, SiteId, Name = "(preview)" }` (no overrides, no bindings). No validation pass (no scripts, no binding completeness) — only the attribute list is needed. Same `FlattenSession` memo, so it is one template-chain walk per call. ### 3.2 Create page (CentralUI `InstanceCreate.razor` + new code-behind) - **Superseded 2026-08-21 (`docs/plans/2026-08-21-template-picker.md`):** the Template `