crestapps/crestapps.agentskills/orchardcore-tenants
Claude Code and agent skill by crestapps/crestapps.agentskills
- community
Checking that the SKILL.md file is still in the repository.
Skill for configuring multi-tenancy in Orchard Core. Covers tenant creation in the admin, the API and code (IShellSettingsManager, UpdateShellSettingsAsync, ShellSettings keys, ISetupService), tenant states, running code in a tenant or in every running tenant, SaaS setup, tenant configuration, the Tenants API, the tenant workflow activities and ITenantValidator validation, feature profiles, tenant removal, generated table prefixes and schemas, and testing with tenants using different recipes. U…
Install
npx vskill@latest install crestapps/crestapps.agentskills/orchardcore-tenantsSKILL.md
The same SKILL.md was published earlier as crestapps/crestapps.agentskills/orchardcore-tenants.
Orchard Core Tenants - Prompt Templates
Configure Multi-Tenancy
You are an Orchard Core expert. Generate tenant configurations and multi-tenancy setup for Orchard Core.
Guidelines
- Orchard Core supports multi-tenancy natively; the SaaS setup recipe enables tenant management on the Default tenant.
- Each tenant is an isolated site sharing the same application instance.
- Tenants can have separate databases or share a database with table prefix isolation, or with a separate schema when the provider supports schemas.
- The
Defaulttenant is the main shell that manages other tenants. EnableOrchardCore.Tenantson it to manage tenants under Multi-Tenancy → Tenants (ManageTenantspermission). - Tenants can use any setup recipe (Blog, Agency, Blank, custom).
- URL prefixes or hostnames route requests to the correct tenant.
- A tenant name is also used as a folder name (for example
App_Data/Sites/{Tenant}and the tenant media root), so the admin UI, the Tenants API, and theCreateTenantTaskworkflow activity all validate it withITenantValidator. - Configure the module under
OrchardCore:Tenants(theOrchardCore_Tenantssection name is deprecated). - Other features:
OrchardCore.Tenants.FileProvider(per-tenant static files fromApp_Data/Sites/{Tenant}/wwwroot, e.g.robots.txt),OrchardCore.Tenants.FeatureProfiles, andOrchardCore.Tenants.Distributed(keeps tenant states in sync across instances; seeorchardcore-shells). - Always seal classes.
Enabling Multi-Tenancy
Use the SaaS recipe during setup to get tenant management out of the box, or enable manually:
Setting Up with the SaaS Recipe
After setup, navigate to Multi-Tenancy → Tenants in the admin panel to create and manage tenants.
Creating a Tenant via Admin UI
- Navigate to Multi-Tenancy → Tenants.
- Click Add Tenant.
- Set the Name (technical name, letters, digits and underscores; it becomes a folder name).
- Set the URL Prefix (e.g.,
blog) or URL Host (e.g.,blog.example.com). - Select a Recipe (Blog, Blank, etc.) and optionally a Feature Profile.
- Choose a Database Provider, and a Table Prefix or Schema if sharing a database (unless generated by a pattern).
- Click Create, then Setup to initialize the tenant.
The tenants list renders through the shared AdminList shape and supports bulk Enable, Disable, and (when allowed) Remove.
Creating a Tenant via Tenants API
The api/tenants endpoints use the Api authentication scheme (for example an OpenID bearer token) and require ManageTenants. Available actions are create, edit, setup, enable/{tenantName}, disable/{tenantName}, and remove/{tenantName}.
Setting Up a Tenant Programmatically
Pass RecipeName for a harvested recipe, or Recipe with the recipe JSON; an inline recipe is written to the tenant-scoped temporary directory (ITempDirectoryProvider, OrchardCore:TempDirectory:Path) before it runs.
Tenant States
ShellSettings.State is a TenantState: Uninitialized (created, not set up), Initializing (setup running), Running, Disabled (set up but turned off), or Invalid. Check it with IsUninitialized(), IsInitializing(), IsRunning(), IsDisabled(), IsInitialized() (running or disabled), IsRemovable() (uninitialized or disabled) and IsDefaultShell(); set it with AsUninitialized(), AsRunning(), AsDisabled(). All live in OrchardCore.Environment.Shell.
Creating a Tenant in Code
This is what the admin Create action does. Run it on the Default tenant with OrchardCore.Tenants enabled, and validate the input with ITenantValidator (namespace OrchardCore.Tenants.Services) first when it comes from users.
| Key | Meaning | |
|---|---|---|
DatabaseProvider, ConnectionString, TablePrefix, Schema | Database settings applied at setup. | |
RecipeName | Setup recipe preselected for the tenant. | |
FeatureProfile | Comma-separated feature profile names. | |
Secret | Token secret used for the setup link. | |
Category, Description | Shown and filterable in the tenants list. |
The new tenant is Uninitialized; it still needs setup (database schema, admin user, recipe). Use Setup in the tenants list, POST api/tenants/setup, or ISetupService.SetupAsync(SetupContext) with SetupConstants property keys (SiteName, AdminUsername, AdminEmail, AdminPassword, SiteTimeZone, DatabaseProvider, DatabaseConnectionString, DatabaseTablePrefix, DatabaseSchema), which is what the API action does.
Creating Tenants from Workflows
With OrchardCore.Workflows enabled, the tenant activities are Create Tenant Task, Setup Tenant Task, Enable Tenant Task, and Disable Tenant Task. CreateTenantTask runs the same ITenantValidator validation as the admin UI and API: an invalid name, a duplicate URL prefix and host, or an unknown feature profile takes the Failed outcome and the validation errors are assigned to LastResult. On success it takes Done with the new ShellSettings in LastResult.
Testing with Blog Tenant
Tenant Configuration in appsettings.json
Each tenant can be configured under a section named after it:
Tenants Module Options
Configure TenantsOptions under OrchardCore:Tenants:
TenantRemovalAllowedallows removing a tenant that is not set up yet or is disabled (defaultfalse).RequireTablePrefixrequires a non-empty table prefix when creating a tenant or editing an uninitialized one, for providers that support prefixes.TablePrefixPatternandSchemaPatternare Fluid templates withShellSettingsin scope. A pattern generates the value and removes the manual field from the tenant UI. Generated and manual values must be valid SQL identifiers (letters, digits, underscores; starting with a letter or underscore).- The built-in SQLite provider does not share a single database file between tenants through these patterns.
When OrchardCore:DatabaseProvider is configured, the provider is fixed and is not selectable in the Setup or Tenants UI. When both OrchardCore:DatabaseProvider and OrchardCore:ConnectionString are configured, the connection string is fixed as well. Setup asks for a connection string only when the selected provider requires one and the tenant has no saved value.
Feature Profiles for Tenants
Enable OrchardCore.Tenants.FeatureProfiles on the Default tenant, then manage profiles under Multi-Tenancy → Feature Profiles (ManageTenantFeatureProfiles). Rules are applied in order; Exclude and Include accept * and ? wildcards. Select a profile when creating or editing a tenant, through the API (FeatureProfiles), or in Auto Setup.
The All Feature Profiles deployment step exports the profiles.
Accessing Tenant Information in Code
Running Tenant-Specific Code
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingsrc/CrestApps.AgentSkills/orchardcore/orchardcore-tenants/SKILL.md
Popularity
- Repository stars
- 13
- Repository forks
- 3
- 7-day trend score
- 13
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/crestapps/crestapps.agentskills/orchardcore-tenants)