Skip to content

feat: persist ConfigurationItem.SectionName + virtual order-model construction seam#498

Open
alexeyshibanov wants to merge 7 commits into
devfrom
feat/configurationitem-sectionname
Open

feat: persist ConfigurationItem.SectionName + virtual order-model construction seam#498
alexeyshibanov wants to merge 7 commits into
devfrom
feat/configurationitem-sectionname

Conversation

@alexeyshibanov

@alexeyshibanov alexeyshibanov commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Description

Persist the configuration section name on the order ConfigurationItem, and add a construction seam to CustomerOrderBuilder so subclasses can dispatch polymorphic order subtypes during cart-to-order conversion.

ConfigurationItem.SectionName

  • Add SectionName to ConfigurationItem (Core) and ConfigurationItemEntity (Data), wired through ToModel / FromModel / Patch.
  • Add the SectionName column migration for PostgreSQL, SQL Server and MySQL.
  • Propagate SectionName from the source cart configuration item when an order is built from a cart — symmetric with the CartModule change.

Virtual order-model construction seam

  • Extract the LineItem / ConfigurationItem instantiation in CustomerOrderBuilder into CreateOrderModel(...) protected virtual methods (default = AbstractTypeFactory<T>.TryCreateInstance()).
  • This lets a subclass choose the concrete order-model subtype based on the source cart item, instead of every order item collapsing to the single registered base type during conversion.

Depends on VirtoCommerce.CartModule (sibling change adding ConfigurationItem.SectionName, which the cart-to-order propagation reads). The package reference currently points at an alpha; replace it with the released version before merge.

References

QA-test:

Jira-link:

Artifact URL:

https://vc3prerelease.blob.core.windows.net/packages/VirtoCommerce.Orders_3.1011.0-pr-498-5422.zip


Note

Medium Risk
Adds a database migration and changes cart-to-order mapping; risk is moderate but mitigated by a nullable column and backward-compatible default factory behavior.

Overview
Adds SectionName to order ConfigurationItem so configured line items can keep the human-readable section label (alongside SectionId) after checkout. The property is mapped on the persistence entity and carried through ToModel / FromModel / Patch, with nullable SectionName columns on OrderConfigurationItem via new EF migrations (MySQL and PostgreSQL in this diff; SQL Server per the PR scope). CustomerOrderBuilder now copies SectionName from the cart configuration item when building an order.

CustomerOrderBuilder also introduces protected virtual CreateOrderModel(...) for LineItem and ConfigurationItem, defaulting to AbstractTypeFactory, so subclasses can instantiate polymorphic order types during cart conversion instead of always using the registered base type.

VirtoCommerce.CartModule.Core is temporarily referenced from an alpha build that exposes cart SectionName; swap to a released package before merge.

Reviewed by Cursor Bugbot for commit 5422b56. Bugbot is set up for automated code reviews on this repo. Configure here.

alexeyshibanov and others added 3 commits June 4, 2026 17:55
…ual seam

CreateOrderLineItem / CreateOrderConfigurationItem split construction from
population so a subclass can dispatch a polymorphic subtype from the source
cart item; default impl preserves AbstractTypeFactory.TryCreateInstance() behaviour.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@alexeyshibanov alexeyshibanov marked this pull request as ready for review June 17, 2026 12:42
alexeyshibanov and others added 2 commits June 17, 2026 15:42
Aligns the Cart dependency with the x-cart branch (PR 127) build, which
targets cart alpha-799. The previous alpha-794 pin predated the cart dev
merge to the 3.1006 line and the ICartProductService/CartProduct keying
changes, causing a binary-incompatible pairing with x-cart in auto-tests.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
alexeyshibanov and others added 2 commits July 2, 2026 14:59
…-sectionname

# Conflicts:
#	src/VirtoCommerce.OrdersModule.Core/VirtoCommerce.OrdersModule.Core.csproj
#	src/VirtoCommerce.OrdersModule.Web/module.manifest
…ruction seam

Rewrite the CreateOrderModel seam-override tests to dispatch distinct order
LineItem/ConfigurationItem subtypes by a source cart property (ProductType /
SectionName), asserting different values yield different CLR types in the order.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@sonarqubecloud

sonarqubecloud Bot commented Jul 2, 2026

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants