Are you an LLM? You can read better optimized documentation at /configuration/storeoptions.md for this page in Markdown format
Configuring Document Storage
The StoreOptions class is the central configuration object for Polecat. It controls connection settings, schema management, serialization, and more.
Connection String
cs
var store = DocumentStore.For(opts =>
{
opts.Connection("Server=localhost;Database=myapp;User Id=sa;Password=YourStrong!Password;TrustServerCertificate=True");
});Schema Name
By default, Polecat uses the dbo schema. You can change this:
cs
opts.DatabaseSchemaName = "myschema";Auto-Create Schema Objects
Control how Polecat manages database schema:
cs
// Default: CreateOrUpdate - auto-creates and updates tables
opts.AutoCreateSchemaObjects = AutoCreate.CreateOrUpdate;
// CreateOnly - only creates new tables, never modifies existing ones
opts.AutoCreateSchemaObjects = AutoCreate.CreateOnly;
// None - never creates or modifies schema objects
opts.AutoCreateSchemaObjects = AutoCreate.None;WARNING
In production environments, consider setting AutoCreate.None and managing schema migrations separately.
Table Prefix
All Polecat tables use the pc_ prefix:
pc_events-- Event logpc_streams-- Stream metadatapc_event_progression-- Async daemon progressionpc_hilo-- HiLo sequence storagepc_doc_{typename}-- Document tables
Store Policies
Apply policies across all document types:
cs
opts.Policies.AllDocumentsSoftDeleted();
opts.Policies.ForDocument<Order>(mapping =>
{
mapping.DeleteStyle = DeleteStyle.SoftDelete;
});Listeners
Register global session listeners:
cs
opts.Listeners.Add(new MySessionListener());See Session Listeners for more details.
Logging
Configure store-level logging:
cs
opts.Logger(new MyPolecatLogger());HiLo Sequence Defaults
Configure default HiLo sequence settings for numeric identity generation:
cs
opts.HiloSequenceDefaults.MaxLo = 500; // default is 1000Initial Data Seeding
Register data to be seeded on application startup:
cs
opts.InitialData.Add(async (store, ct) =>
{
await using var session = store.LightweightSession();
session.Store(new User { FirstName = "Admin", LastName = "User" });
await session.SaveChangesAsync(ct);
});See Initial Baseline Data for more details.

JasperFx provides formal support for Polecat and other Critter Stack libraries. Please check our