InMemoryCatalog class
An in-memory catalog: every store, one transaction over all of them, and the model's rules and operations wired the way a composition root would.
This is the reference an implementer reads. Swap the ten stores for your own implementations of the contracts and the operations below are unchanged — they are typed against the interfaces, not against these classes.
Three things worth copying:
- the stores are contracts: skus is an ISkuRepository, so it goes anywhere a contract is expected;
- the transaction covers every table (unitOfWork), so a multi-write operation cannot half-commit because someone forgot to register a store;
- the unique-value rule needs nothing from a backend. It reads
fetchAll()and scans, which is correct and slow; a real adapter that wants it cheap indexes the unique keys on its own side (see AssertUniqueAttributeValues).
Deliberately not wrapped: the single-store use cases. FetchAllSkus(skus) or
CreateTrait(traits) is already one line with the store in hand, and wrapping
all of them would be a second copy of the operations ring. A single-store
write that carries a rule is wrapped, because the rule is the point —
createLocate and createManufacturer are here for the same reason
createInstance is.
Constructors
- InMemoryCatalog()
- Creates an empty in-memory catalog.
Properties
- addSkuComponent → AddSkuComponent
-
Adds an assembly edge, refusing a cycle or a missing SKU.
latefinal
- assemblies → InMemorySkuComponentRepository
-
Assembly edges — a SKU containing SKUs.
final
- associations → InMemorySkuAssociationRepository
-
Association edges — a labeled relationship between SKUs.
final
- attributes → InMemoryTraitAttributeDefinitionRepository
-
Trait attribute definitions.
final
- billOfMaterials → AggregateBillOfMaterials
-
Folds an assembly tree into the parts a build needs.
latefinal
- createInstance → CreateInstance
-
Creates an instance, guarded by the model's rules.
latefinal
- createLocate → CreateLocate
-
Creates a place, guarded by the unique-value rule — a place holds values
like an article does.
latefinal
- createManufacturer → CreateManufacturer
-
Creates a maker, guarded by the unique-value rule.
latefinal
- deleteInstance → DeleteInstance
-
Deletes an instance and its images in one transaction.
latefinal
- deleteSku → DeleteSku
-
Deletes a SKU and its assembly edges in one transaction, refusing while
instances still use it.
latefinal
- duplicateInstance → DuplicateInstance
-
Copies an instance: a new article, with every unique value dropped.
latefinal
- effectiveAttributes → ResolveEffectiveAttributes
-
Resolves the values in scope for one article.
latefinal
- hashCode → int
-
The hash code for this object.
no setterinherited
- images → InMemoryImageRepository
-
Image records.
final
- instances → InMemoryInstanceRepository
-
Instances — the articles of a SKU.
final
- instanceSchema → ResolveInstanceSchema
-
The schema in scope for one article: its own traits plus its model's.
latefinal
- locates → InMemoryLocateRepository
-
Places, as a tree.
final
- manufacturers → InMemoryManufacturerRepository
-
Manufacturers.
final
- meta → InMemoryMetaRepository
-
The catalog's own meta record.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- schema → ResolveSchema
-
The trait/attribute schema resolver.
latefinal
- skuAttributes → ResolveSkuAttributes
-
Resolves the values in scope for one model, inside its assemblies.
latefinal
- skus → InMemorySkuRepository
-
SKUs.
final
- traits → InMemoryTraitRepository
-
Traits.
final
- uniqueNames → AssertUniqueInstanceName
-
The per-place unique name rule.
latefinal
- uniqueValues → AssertUniqueAttributeValues
-
The unique-value rule. It reads every holder — articles, places, makers —
so a value marked unique is held once in the catalog, whatever kind holds
it.
latefinal
- unitOfWork → InMemoryUnitOfWork
-
A transaction over every table above, for the use cases that write twice.
latefinal
- updateInstance → UpdateInstance
-
Updates an instance, guarded by the model's rules.
latefinal
- updateLocate → UpdateLocate
-
Updates a place, guarded by the tree rule and the unique-value rule.
latefinal
- updateManufacturer → UpdateManufacturer
-
Updates a maker, guarded by the unique-value rule.
latefinal
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited