Skip to main content

Languages, markets and channels

Context memberships determine which entities belong to a market or channel. Varying properties determine which values a reader sees there.

For the team workflow, see Choose an assortment.

Contexts describe dimensions such as language, sales channel, market, or customer segment. A VoxVarying property can store a different value in each selected context, while context membership controls which entities belong to which context entities. Memberships are declared by the entity types, and are written for an entity, inherited through its relations, calculated, derived from its varying values, or a combination. Nothing is a member of a context just because the context exists: a new market has no members until something puts an entity there.

Context memberships participate in Vox's dependency graph. If a product enters a market, or a related category stops belonging to a channel, only the rules and outputs that observed that membership need to run again. See Dependency and change tracking.

Contexts are entities​

A context type implements IVoxContext, so its contexts are managed and related like other entities. The ID is the value used in contextual data: a Language might contain en, sv and fi-sv, while a Channel contains web and app.

public class Language : IVoxEntity, IVoxLanguage
{
// Built-in entity properties omitted.
public required string Id { get; set; }
public required string Name { get; set; }
public List<string> Fallbacks { get; set; } = [];
}

IVoxLanguage : IVoxContext is a semantic role for reusable models and add-ons. Exactly one registered concrete context entity may implement it. The interface deliberately does not require a culture, direction, display name, or fallback shape: applications keep those choices in their Language entity. Vox still stores and exposes the concrete type and its IDs; the interface only lets a property say "this varies by the application's content language". The contexts API marks its context type with isLanguage, and the admin UI shows titles in the first of the browser's languages that is a member, matched by ID, eg en for en-US. Language tags such as en and sv are therefore good IDs; with other IDs, editors choose their language in the admin's top bar.

A read selects contexts of some context types, eg ?context=language:sv,market:se. That selection is used consistently when Vox resolves varying properties, applies variations, filters or sorts varying query fields, and checks context membership.

The Vox-Display-Context request header, in the same syntax, eg Vox-Display-Context: language:en,market:se, only chooses which value the titles that the API makes are shown in when the read didn't resolve them: the titles of references with ?titles=, of effects and of context members. It follows a member's fallbacks when the property uses them. It never filters entities, resolves values or changes a write, and an unknown context type or member is ignored. The admin UI sends the language and market chosen in its top bar with every request. An admin UI served from another origin than the API needs the header allowed in the API's CORS policy. Responses that used it vary by it.

Drafts and content releases aren't contexts: they're authoring scopes, chosen with ?scope=, eg ?scope=draft&context=language:sv. The scope's version of an entity is composed first, and the selected contexts are resolved within it.

Selecting contexts​

A caller can select a member of any context type explicitly. A context type can also be selected from the request, with traits on the Vox options:

using CommerceMind.Vox.Abstractions.Configuration;

builder.AddVox(options =>
{
// The language of the path, eg /sv/jackets, from the criteria of each language
options.ConfigureContextType<Language>(type => type.SelectedByCriteria());
// The variants of experiments that run at once, a visitor in one variant of each experiment
options.ConfigureContextType<Variant>(type => type.SelectedByCriteria().Concurrent(variant => variant.Experiment));
// Warehouses from a service, which only Vox can call
options.ConfigureContextType<Warehouse>(type => type.Programmatic<WarehouseSelector>());
// A view that only staff may select
options.ConfigureContextType<StaffView>(type => type.Restricted("app:StaffView"));
});
  • Criteria. Each member of a context type selected by criteria has a criteria expression in its selectionCriteria field, a JSON tree, eg { "startsWith": { "input": "path", "value": "/sv/" } }. A request selects the members whose criteria hold. Criteria read the request, the caller's claims, the time, the visitor's bucket and the members selected of other context types, and they're exported in the context manifest, so a delivery system selects the same way. See Portable contexts. The context entity declares the field by implementing IVoxCriteriaSelected, and SelectedByCriteria() only accepts such a type, see Declaring criteria.
  • Programmatic. An IVoxContextSelector<TContext> selects members with application code. It runs in Vox only, so a delivery system gets the members of the context type from its caller. It can read anything of the request, so a response of a request it runs for isn't stored in shared caches, also when it selects nothing.
  • One member, or one of each group. A context type has one selected member at most, so the criteria of members that can apply to the same request exclude each other, eg staff and business customers, and a selection with two is an error rather than a choice. A concurrent context type can have several, one of each group: the variants of experiments that run at the same time, of which a visitor is in one of each experiment. They set different values, eg different flags of a settings entity, and an entity that's a member of the context type is read if it's a member of one of them. Where two set the same value, the lower id wins, which isn't something to rely on.
  • Restricted. Selecting a member needs the permission. Its cells are only read when it's selected, it isn't in the manifest that delivery clients get, and responses in a selection of it aren't stored in shared caches.

An explicit member always wins over criteria and selectors, and so does an explicit empty list, which selects no member of the context type. Responses vary on the inputs that criteria read, and are cached at most until a criterion of the time can change the selection.

Declaring criteria​

A context type selected by criteria is an entity class that implements IVoxCriteriaSelected, from CommerceMind.Vox.Abstractions.Contexts, with a SelectionCriteria property, which is selectionCriteria in JSON:

public class Language : IVoxEntity, IVoxLanguage, IVoxCriteriaSelected
{
// Built-in entity properties omitted.
public required string Id { get; set; }
public required string Name { get; set; }
public List<string> Fallbacks { get; set; } = [];
public string? SelectionCriteria { get; set; }
}

SelectedByCriteria() is an extension method in CommerceMind.Vox.Abstractions.Configuration constrained to such types, so a context type without the property can't be configured to be selected by criteria. A member without criteria is only selected explicitly.

The criteria are an owned field like any other. A complete write of a member that leaves them out clears them, and a partial update that doesn't name them keeps them. A context type's contract exported to other applications leaves SelectionCriteria out, since how a member is selected is the configuration of each application. A received context type has no actions in the receiving application, so it can't edit criteria of its own for it through the API.

Prefer criteria over programmatic selection​

Criteria are data with a specified meaning: the context manifest exports them, and the portable selector evaluates them the same way in Vox, in a delivery system, in an edge worker or in a test. So a delivery system selects the same members as Vox's preview, the admin can test them with a sample request, and a response can tell which inputs it varies on. A programmatic selector is code that runs only in Vox: a delivery system can't run it, so its context type is marked as not portable in the manifest, and the admin shows it as not available in delivery. Use a selector only when the members can't be derived from the request, eg when they come from a service, and select them explicitly outside Vox.

Cells, keys and experiments​

Contexts are the application's dimensions only. Markets, channels and experiments are context types, and their values are cells keyed by members, which hold only the values they set:

Context typeMembersTraits
a marketits ids, eg seconfigured by the application
an experimentits variants, eg hero-bconcurrent, configured by the application

Every entity type has cells at the keys of the application's context types, eg Language=sv|Market=se. A cell key, VoxCellKey, names application contexts only, and a context type name starting with $ is rejected. Where a cell is stored is its authoring scope and its key, the VoxCellAddress, written draft|Language=sv: the Swedish cell of the draft.

Deleting a member of a context type retires it in the transaction of the delete: from then on nothing reads its cells, links or memberships, a selection leaves it out, and its addresses can't be written to. Its cells, and the values they gave filters, sorting and unique constraints, are then cleaned up in the background a page at a time, which notifies what read the published ones, so deleting a language with content of the whole catalogue returns at once. The same id can't be created again until the cleanup is done, so it never deletes content of a new member. GET api/background-work, and the Background work section of the admin's Model screen, show how far each cleanup has come: its step of all the steps, and how many entities it has notified. So the context entity types are stored by a provider that stores the cells of contexts, the ContextCells capability, together with the entity types that have cells, eg by Entity Framework, and Vox refuses to start otherwise.

The traits of a context type decide how its cells behave:

  • Concurrent. Several members can be selected at once, one of each group, see above.
  • Selection. Members are selected explicitly, by criteria or programmatically, see above.
  • Restricted. Selecting a member needs a permission.

The context stacking order, VoxOptions.ContextStackingOrder, ranks the application's context types, eg whether Market=se or Channel=app wins where both set a value, see Variations. It never ranks scopes, whose ancestry is fixed.

An experiment is a concurrent context type whose members are the variants of the experiments, selected by criteria of the visitor's bucket. Entity types aren't members of it, so every entity is read in every variant, with the values the variant sets. The variants of one experiment are a group: they share the visitor's bucket, so their ranges split the visitors between them.

options.ConfigureContextType<Variant>(type => type.SelectedByCriteria().Concurrent(variant => variant.Experiment));

The values of a variant are cells keyed by it, like those of a market, eg {Variant=hero-b} or {Variant=hero-b|Language=sv}, written with IVoxEntityCellUpdater or in a draft, eg at draft|Variant=hero-b, and shown to the visitors its criteria select. IVoxContextPromoter.PromoteAsync<Variant> promotes the winner: in one transaction, it writes the values of the variant where they'd be without it, eg {Variant=hero-b} into the published entity and {Variant=hero-b|Language=sv} into the Swedish cell, over what's there, and deletes the member. A variant with unpublished drafts of its values isn't promoted until they're published or reverted. Deleting the other variants deletes every cell keyed by them. Deleting any context member, eg a market or a variant, retires every cell keyed by it in the transaction of the delete, and cleans them up afterwards.

An experiment can run in several applications that synchronize its variants: each one has values of its own entities at them, and promotes its own values of the winner, which the application that owns the variant deletes when it promotes it there. So an application promotes a variant before its owner does: the deletion of the variant deletes the values that are still at it.

Calculated values have cells too. Where something a calculation reads has a variation, eg a campaign's Swedish title, the calculation runs at that key, and its result is stored there when it differs from the general one. A calculation can also set its results at keys it chooses from its data, eg member prices at CustomerGroup=member from a member price list, without a model change, see Results at chosen keys. Both are read by the same precedence as authored cells, and a consumer runs at such a key only if it read a field the entity has a value of there, see Where consumers run.

What validation guarantees​

A write validates the resolved entity at the key it writes, and at the keys above it that already have cells. A merge validates again in the parent scope, and unique constraints are enforced on published content when changes are merged. So field rules hold in every cell, and validators across fields hold at the keys that were written and merged into.

A combination of cells that were written separately isn't validated as a whole: a published Market=se cell and a general change in release autumn read together can fail a validator across fields, eg one that compares a price with a campaign price, since neither write saw the other. Keep rules that span fields within what one write sets, or check the combinations that matter with an assessment.

Values that vary​

Use VoxVarying<TContext, TValue> for a property whose values are intrinsically stored per context:

public class Product : IVoxEntity
{
[VoxVarying(typeof(IVoxLanguage), UseFallbacks = true)]
public VoxVarying<IVoxLanguage, string> Name { get; set; } = new();

[VoxVarying(typeof(Channel), AllowInvariant = true)]
public VoxVarying<Channel, string> CallToAction { get; set; } = new();
}

The stored JSON is keyed by context ID. A value can also vary on two context types, such as language and channel, when each combination may have its own value.

UseFallbacks resolves a missing value through the selected context's fallback order. For example, Finland Swedish can fall back to Swedish and then English. An IVoxContextFallback<TContext> supplies that order. Context types have no fallback behavior unless an implementation defines it.

Register fallbacks for the concrete entity, for example IVoxContextFallback<Language>. Selecting or resolving through IVoxLanguage first maps the role to Language and then uses that concrete fallback. Multiple language-role implementations, or a VoxVarying<IVoxLanguage, ...> without one, fail model construction with a diagnostic naming the conflicting or missing types.

AllowInvariant permits a value that is independent of that context type. Resolution checks the selected context, then any enabled fallbacks, then the invariant value. A property can combine these choices independently for each of its context dimensions.

The values of each context are versioned on their own. Two editors who translate different languages of the same product from the same version don't conflict, while a stale edit of the same language does. An action that replaces every value, such as SetName, changes every language, so it conflicts with an edit of any of them. In a draft or a release, each language is published with the rest of the draft, and conflicts only when the published values of that language changed after the draft was based on them. The entity reads the same as before: its varying properties have all of their values.

Use a variation instead when the entity has a useful value of its own and only selected context combinations need another one.

Context membership​

Membership answers a different question from varying values: whether an entity belongs in a context at all. A product may have names in several languages but only be offered in some markets and channels.

Memberships are opt-in. An entity type is a member of the contexts of a context type only if it's declared one with [VoxMemberOf], so a relation to a context entity doesn't make an entity a member of it: a price list for a market is just related to that market.

// Categories are put in channels, and are also in the channels of their parent
[VoxMemberOf(typeof(Channel), Through = [nameof(Parent)], Explicit = true)]
public class Category : IVoxEntity { ... }

// Products are in the channels of their categories
[VoxMemberOf(typeof(Channel), Through = ["categories"])]
public abstract class ProductBase : IVoxEntity { ... }

A membership is the existence of the entity in the context, stored as an existence cell keyed by it, eg {Channel=web}. It comes about in up to four ways:

  • Written. With Explicit, the default when there's nothing to inherit through, memberships are written for the entity with IVoxEntityUpdater.SetExistsAsync, or in the cell editor of the admin, the Variations tab:

    await updater.SetExistsAsync<Category>("t-shirts", VoxCellKey.Baseline.With(nameof(Channel), "web"), true);
  • Inherited through the relations in Through: an entity is a member of the contexts that the related entities are members of, or of the related contexts themselves for a relation to the context type. The related entity types must be declared members too, and inheritance continues through every level, eg from a category to its parent. A name in Through can be the inverse name of a relation to the entity type: an image with [VoxMemberOf(typeof(Channel), Through = ["products"])], the inverse of Product.Media, is a member of the union of the channels of the products that refer to it. Removing one product keeps it in the channels of the others, and removing the last one takes it out, without a list of products on the image.

    Inheriting through an inverse relation reads every entity that refers to the entity, and works up to VoxReadBudgets.MaxRelationLinks (10,000) referrers. Below that, each referrer is a dependency of the entity, and a change of one referrer's memberships reads them all again. Above it, the entity's membership calculation fails with VoxReadBudgetExceededException, which the processing health shows: a category with 15,000 products gets no markets through them, or keeps the markets it had when it crossed the limit, and a size chart image used by 15,000 products gets no channels. The same limit applies to a forward relation kept in the relation index: a bundle that links to 15,000 products and inherits their markets fails the same way, rather than inheriting from the first 10,000 only. Give an entity that can have more related entities its contexts another way: written, from a membership calculation, or through a forward relation to fewer entities, eg a category that refers to its markets.

  • Calculated by a membership calculation, see below.

  • From its values. An owned or imported VoxVarying property declares the membership by itself, without [VoxMemberOf]: an entity is a member of the contexts it has values for. A product with a Swedish name is a member of Swedish, and stops being one when its last Swedish value is removed:

    public class Product : IVoxEntity
    {
    // A product is in the languages it has names or descriptions in
    public virtual VoxVarying<IVoxLanguage, string> Name { get; set; } = new();
    public virtual VoxVarying<IVoxLanguage, VoxRichText> Description { get; set; } = new();
    }

    Every owned or imported varying property counts, so a Swedish description alone is enough. Calculated values don't, since calculations follow memberships rather than create them, and neither do variations of fields that don't vary (a different Price at {Market=se}), invariant values at *, or fallbacks. A value at {Market=se|Language=sv} makes the entity a member of se and of sv. Singletons, context entity types and light entity types derive no memberships from values: a setting applies in every language, a market is listed in a language it has no name in, and a list entry is offered in every language. A membership calculation and owned or imported varying values of the same context type are rejected at startup: the membership is either calculated or derived from the values.

A written membership or non-membership overrides an inherited, calculated or value-derived one, so a product can be left out of a channel its category is in, or of Swedish although it has a Swedish name, if the membership is declared Explicit. Writing null deletes it, so the entity inherits its membership again. Memberships are written where the entity is edited: in a draft, eg authoringUpdater.SetExistsAsync<Category>("t-shirts", VoxContentScope.Draft, VoxCellKey.Baseline.With(nameof(Channel), "web"), true), they're part of the draft and published with it, and in a content release they're items of the release.

When one of its contexts is selected, an entity type that's a member of the context type is only read if the entity is a member of the selected context, or of a context the selected one falls back to: a product with Swedish names is read in Finland Swedish when Finland Swedish falls back to Swedish. An entity without an existence cell for a context isn't a member of it. Entity types that aren't members of the context type are read in every context. With every language falling back to English, a product with English names is read in every language, while one with only Danish names isn't read in Swedish.

Creating a context gives it no members. Memberships that are written, inherited or derived from values need something else to happen first, eg a Danish name. A membership calculation that has every context as a candidate evaluates a created context alone for every entity, see below.

A grant of a permission in contexts of a context type, eg in Swedish, is about the entities in those contexts when the entity type is declared a member of it with [VoxMemberOf]: they're the entities it reads and changes. When the memberships only come from values, the grant is about the values instead, like for a context type the entity type only varies on: it reads every entity, and changes its values in those contexts, including the first one, eg a Swedish name of a product that has none yet, but not the values that are the same in every context.

Users and API clients can be members too, and a grant can then be limited to the principal's own contexts, eg a brand manager who edits the products of their brands, see Grants limited to contexts. They're gated like every member type: a team lead with { "permission": "ApplicationUser:Read", "ownContexts": ["Team"] } reads the users of their teams, with users members of a Team context type through a teams relation.

Hierarchies. A context type can't be a member of itself: reads of it would be gated by its own selected member, so with "Outdoor" selected a read of categories would hide "Outdoor". Model a hierarchy of contexts with a separate context type instead, eg a category policy that a top category refers to:

// A category is in the policy it refers to and in the policies of its parent, through every level
[VoxMemberOf(typeof(CategoryPolicy), Through = ["policy", nameof(Parent)])]
public class Category : IVoxAuthoredEntity { ... }

// A product is in the policies of its categories
[VoxMemberOf(typeof(CategoryPolicy), Through = ["categories"])]
public class Product : IVoxEntity { ... }

The memberships are a union: a subcategory with a policy of its own is in both its own and its parent's, so whoever manages a category manages everything beneath it. For "the nearest policy wins", add a membership calculation on the category that keeps a category with a policy of its own to that policy. Each level is recalculated from the stored memberships of the level above, so a change at the top reaches the bottom of a deep tree after one processing round per level. A tree's parent can't form a cycle: moving "Outdoor" under one of its own subcategories is refused when it's written, and a draft that would close a cycle is refused when it's published, since a cycle would keep memberships inherited through the parent alive after their source is gone. Imports aren't checked: a source system that sends a cycle has it stored, and the memberships in it stay until the source breaks the cycle.

A membership can also apply only in other contexts, eg a category that's in the web channel except in Swedish. Its key then has those contexts too:

await updater.SetExistsAsync<Category>("t-shirts",
VoxCellKey.Baseline.With(nameof(Channel), "web").With(nameof(Language), "sv"), false);

A read resolves the membership in its selection like the values of cells: the most specific key that the entity has a cell at and that the selection matches wins, so with Swedish selected, or Finland Swedish falling back to Swedish, the category isn't in the web channel, while in English the cell at {Channel=web} applies. Memberships inherited through relations follow it: the products of the category are left out of the web channel in Swedish too, and Vox stores their cells at a key only where they differ from the less specific ones. In the API, the key of a write has the other contexts, eg PUT api/categories/t-shirts/existence/channel/web?key=Language=sv, and the cells of an entity, GET api/categories/t-shirts/cells, list its explicit existence cells at every key.

In the admin, existence is edited in the cell editor, for each context type the entity type is declared a member of: its members are "Shown in", as shown, not shown or inherit, which tells what the entity inherits and through which relations, or which values give it the membership, eg "derived from values in name". A variation keyed by other contexts, eg Swedish, sets the existence there too, eg not shown in the web channel in Swedish, and a variation can have only existence. The preview shows whether the entity exists in the picked contexts. A context type whose memberships are only calculated, inherited or derived from values, without Explicit, is shown read-only.

Existence in drafts and releases​

The existence cells of a draft or release are changes of the published existence of their members, like the links of an index-backed relation. Merging applies each one over the current published cell of its member and key, so changes of different members in the draft and in published content combine, and a member that changed on both sides takes the draft's value. Existence never conflicts. A draft within a release merges into the release the same way.

In an authoring scope, eg the draft, removing an explicit existence cell, ie writing null, removes the draft's change, so the entity has its published existence there: a draft can't record the removal of a published cell, which is done in published content. The cell editor labels it "No change".

A restore of a publication, eg the revert of a release, puts back the existence of the members it changed, and conflicts on a member whose published existence changed again since, like a field. Then nothing of the publication is undone.

Drafts and release items report their existence and link changes, in ChangedExistence and ChangedRelations of VoxDraftInfo and VoxContentReleaseItem, so a draft that only changes where an entity is shown is listed as changed.

Vox stores the published memberships apart from entity JSON, so they can be queried, included in API results with includeMemberships and used to constrain reads. Lists and queries in a draft or a release filter by the published memberships, while an entity read by its id has its memberships there.

Calculated context memberships​

A membership calculation decides which candidate contexts an entity is a member of. If the membership is inherited through relations, only the contexts reached through them are candidates. Otherwise every stored entity of the context type is a candidate. There can be one IVoxContextMembershipCalculation<TEntity, TContext> for each pair, and the entity type must be declared a member with [VoxMemberOf], eg [VoxMemberOf(typeof(Market), Explicit = false)] for memberships that are only calculated.

This makes it possible to use relations for one context and calculations alone for another. For example, products can inherit their channels from their categories while their market memberships are inferred from price and inventory data:

public class ProductMarketMembership(TimeProvider timeProvider)
: IVoxContextMembershipCalculation<Product, Market>
{
public async Task<bool> IsMemberAsync(
Product product,
Market market,
IVoxEvaluationContext context,
CancellationToken cancellationToken)
{
var prices = await context.LoadRelatedAsync<Price>(product, cancellationToken);
var stock = await context.LoadRelatedAsync<StockLevel>(product, cancellationToken);
var stores = await context.GetManyAsync<Store>(
stock.Select(level => level.Store.Id).Distinct(), cancellationToken);

foreach (var boundary in prices
.SelectMany(price => new[] { price.ValidFromUtc, price.ValidToUtc })
.OfType<DateTime>())
{
context.ReevaluateAt(boundary);
}

var now = timeProvider.GetUtcNow().UtcDateTime;
var hasCurrentPrice = prices.Any(price =>
price.Market.Id == market.Id &&
(price.ValidFromUtc == null || price.ValidFromUtc <= now) &&
(price.ValidToUtc == null || now < price.ValidToUtc));

var stockedStores = stock
.Where(level => level.OnHand - level.Reserved > 0)
.Select(level => level.Store.Id)
.ToHashSet();
var hasInventory = stores.Any(store =>
store.Market.Id == market.Id && stockedStores.Contains(store.Id));

return hasCurrentPrice && hasInventory;
}
}

Because Product doesn't inherit its markets through a relation, Vox tests every stored market. Creating a market evaluates that market alone for every product, a page at a time: IsMemberAsync runs once per product, for the new market, and the product's memberships of the other markets stay as they are. Changing a market recalculates the memberships of the products whose calculation read it, and deleting one removes its memberships with it. If the membership is later inherited through a relation, the same calculation narrows the contexts reached through it.

Prefer a relation when the candidates can be expressed as one, eg the markets a product may be sold in as references to Market rather than a list of market ids, inherited with Through. Then a new market only reaches the products that are linked to it, while a calculation over every market is the expensive fallback: a new market is evaluated for every product of the catalogue, and a change of a market recalculates every product as a whole.

The next example assumes a product/market membership inherited through a relation and keeps it only while the product is published. ReevaluateAt records the boundaries at which the answer may change; Vox schedules durable recalculations even when the current result did not change.

public class PublishedProductMarketMembership(TimeProvider timeProvider)
: IVoxContextMembershipCalculation<Product, Market>
{
public Task<bool> IsMemberAsync(
Product product,
Market market,
IVoxEvaluationContext context,
CancellationToken cancellationToken)
{
if (product.PublishedFrom is { } publishedFrom)
{
context.ReevaluateAt(publishedFrom);
}

if (product.PublishedTo is { } publishedTo)
{
context.ReevaluateAt(publishedTo);
}

var now = timeProvider.GetUtcNow().UtcDateTime;
return Task.FromResult(
(product.PublishedFrom == null || product.PublishedFrom <= now) &&
(product.PublishedTo == null || now < product.PublishedTo));
}
}

Membership calculations can also depend on the stored memberships of related entities. The batch read records a dependency for every supplied entity, including those with no current membership, so creating or removing a membership later triggers the calculation again.

public class BundleMarketMembership : IVoxContextMembershipCalculation<Bundle, Market>
{
public async Task<bool> IsMemberAsync(
Bundle bundle,
Market market,
IVoxEvaluationContext context,
CancellationToken cancellationToken)
{
var products = await context.LoadRelatedAsync<Product>(bundle, cancellationToken);
var marketIdsByProduct = await context.GetContextIdsAsync<Market>(products, cancellationToken);
return products.Any(product => marketIdsByProduct[product.Id].Contains(market.Id));
}
}

A membership calculation reads through an IVoxEvaluationContext, the same tracked reads a calculation has. ReevaluateAt is available to ordinary calculated-property calculations as well. Local DateTime values are converted to UTC, unspecified values are treated as UTC, past instants are ignored, and only the earliest future instant requested by a run is retained. Eg a variant's availability calculation schedules recalculation at price validity boundaries, and a product's membership can be derived from the sellable markets of its variants.