PhoenixmlDb.Core
ContainerOptions
Configuration options for an , controlling indexing, namespace bindings, validation, and whitespace handling.
#ContainerOptions
Namespace: PhoenixmlDb.Core
Configuration options for an
, controlling indexing, namespace bindings, validation, and whitespace handling.
ContainerOptions is passed to IDocumentDatabase.CreateContainerAsync or IDocumentDatabase.OpenOrCreateContainerAsync via a configuration action. The options are applied at container creation time and govern how documents are stored, validated, and indexed.
The most important property is ContainerOptions.Indexes, which provides a fluent API for defining the indexes that accelerate XQuery queries. Indexes should be configured before documents are added — existing documents are not retroactively indexed when new index definitions are added later.
#Example
var container = await db.CreateContainerAsync("products", opts =>
{
// Index product IDs for fast lookup
opts.Indexes
.AddPathIndex("//product/@id")
.AddValueIndex("//product/price", XdmValueType.XdmDecimal)
.AddFullTextIndex("//product/description")
.AddMetadataIndex("category", XdmValueType.XdmString);
// Register namespaces so queries don't need to declare them
opts.DefaultNamespaces.Add("p", "http://example.com/products");
// Validate all incoming documents
opts.ValidationMode = ValidationMode.WellFormed;
});
#Properties
| Name | Description |
|---|---|
DefaultMetadataNamespace
|
The namespace URI that unqualified metadata names resolve to in this container. |
DefaultNamespaces
|
Gets the default namespace prefix-to-URI bindings for this container. |
Indexes
|
Gets the index configuration for this container, providing a fluent API for defining path, value, full-text, name, and metadata indexes. |
PreserveWhitespace
|
Gets or sets whether to preserve insignificant whitespace in XML documents. Defaults to false.
|
ValidationMode
|
Gets or sets the validation mode applied to documents when they are stored. Defaults to ValidationMode.None.
|