Skip to content

DBContext Capability Profiles

Mike Christensen edited this page Aug 28, 2026 · 1 revision

DBContext capability profiles

DBContext has three configurable in-memory features. Persistent database operations work when none are enabled.

Capability Loaded data Required by
IngredientAutocomplete Ingredient-name substring index AutocompleteIngredient
IngredientParsing Ingredient, unit, form, prep-note, anomaly, and numeric grammar ParseIngredient, ParseIngredientUsage, raw shopping-list items
RecipeModeler Recipe, ingredient, rating, tag, and suggestion graph Recipe-modeling APIs
// Default, for backward compatibility
.Capabilities(DBContextCapabilities.All)

// Recipe site with typed shopping additions
.Capabilities(DBContextCapabilities.IngredientParsing)

// Database-only API
.Capabilities(DBContextCapabilities.None)

// Combine flags
.Capabilities(DBContextCapabilities.IngredientParsing |
              DBContextCapabilities.IngredientAutocomplete)

Database search, recipe reads and writes, ingredient reads, menus, queues, and persisted shopping lists do not require flags. AggregateRecipes uses the modeler graph when enabled and otherwise loads recipes from the database.

Calling a guarded API without its flag throws ContextCapabilityNotEnabledException; its Capability property names the missing flag. Capabilities are initialization policy, not per-request switches.

Sample measurements

Linux/.NET 10/PostgreSQL 17 measurements with 2,707 ingredients and 30 recipes:

Profile Startup Managed memory Working set
All 1,567 ms 133.0 MiB 262.5 MiB
Parsing + modeler 1,072 ms 71.5 MiB 185.7 MiB
Parsing only 993 ms 71.4 MiB 180.3 MiB
Autocomplete only 1,049 ms 66.6 MiB 183.4 MiB
Modeler only 663 ms 5.2 MiB 114.0 MiB
Database only 532 ms 5.0 MiB 111.8 MiB

These compare profiles, not production sizing. The sample has very few recipes; a production modeler graph can be much larger. Measure your data and runtime. The Web App sample demonstrates parsing-only startup.

Clone this wiki locally