> For the complete documentation index, see [llms.txt](https://docs.zongsoft.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.zongsoft.com/documentation/en/framework/core/common/sequence.md).

# Sequence Generators

Responsibilities are generated with external serial numbers and site domain descriptions in the Discussions map.

The sequence generator is responsible for generating numbers by name or business scope. Discussions does not implement a demo serial number service by itself, but declares external serial number requirements in the mapping, which are generated by the data engine and deployed provider.

## Topics Use External Ordinal Numbers

Source: [src/Zongsoft.Discussions.mapping](https://github.com/Zongsoft/Zongsoft.Discussions/blob/main/src/Zongsoft.Discussions.mapping#L293) (excerpt; see source for context).

{% code title="Zongsoft.Discussions.mapping" %}

```xml
<property name="ThreadId" type="ulong" nullable="false" sequence="#" />
```

{% endcode %}

`#` denotes an external sequence. When a business insert method is called, the identifier may not have been generated yet, so a default identifier cannot provide a unique name for a new file. The current content filenames also include a random suffix; see [Randomizer](/documentation/en/framework/core/common/randomizer.md).

## The Forum Is Divided Into Domains by Site

Source: [src/Zongsoft.Discussions.mapping](https://github.com/Zongsoft/Zongsoft.Discussions/blob/main/src/Zongsoft.Discussions.mapping#L203) (excerpt; see source for context).

{% code title="Zongsoft.Discussions.mapping" %}

```xml
<property name="ForumId" type="ushort" nullable="false" sequence="#(SiteId)" />
```

{% endcode %}

The ForumId's number range is associated with the SiteId. Model relationships and database keys also need to include sites, otherwise identical numbers within different sites will be confused.

## Basic Serial Number and Local Number Segment

ISequenceBase expresses basic increment, reset and other capabilities; the framework can also obtain number segment allocation through Variate packaging. The number segment reduces the number of remote calls, but the process exit may leave unused numbers, which cannot guarantee continuity without gaps.

The Discussions listing does not have a fixed sequence generator implementation, the deployer must check the actual provider and name. The framework [SequenceTest](https://github.com/Zongsoft/framework/blob/main/Zongsoft.Core/test/Common/SequenceTest.cs) verifies the number segment growth and reset, and [Redis SequenceTest](https://github.com/Zongsoft/framework/blob/main/externals/redis/test/SequenceTest.cs) provides specific implementation reference. Don't use fixed intervals in testing as production configurations.

## Use Boundaries

Successful number generation does not mean that the business write has been submitted. Rollbacks, retries, and cross-node concurrency all affect number usage. Resetting existing business numbers may also lead to key conflicts, which must be evaluated together with persistent data and cache number segments.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.zongsoft.com/documentation/en/framework/core/common/sequence.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
