Covers Entity Framework Core persistence for CrestApps.Core 2.0: store registration, schema initialization, table prefix configuration, and per-feature store setup for personas, AI profiles, web crawlers, and document catalogs.
Ships in crestapps-core. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
You are a CrestApps.Core expert. Generate accurate Entity Framework Core persistence code with CrestApps.Core.Data.EntityCore.
.AddEntityCoreSqliteDataStore(connectionString, tablePrefix: "CA_") or .AddEntityCoreDataStore(options => options.UseNpgsql(...), store => store.TablePrefix = "App_"). They map to AddCoreEntityCoreSqliteDataStore(...) and AddCoreEntityCoreDataStore(...) on IServiceCollection and register CrestAppsEntityDbContext plus scoped EntityCoreStoreCommitter.AddEntityCoreStores() on a feature builder selects that feature's stores. It never registers the DbContext.EntityCoreStoreCommitter.CommitAsync() calls SaveChangesAsync() only when ChangeTracker.HasChanges() is true. Writes that never reach a commit boundary are lost when the scope ends.EntityCoreDataStoreOptions.TablePrefix defaults to "CA_". EnforceNamedSourceUniqueness (default false) adds a unique index on entity type, source and name; enable it only after removing duplicates.CrestAppsEntityDbContext is sealed. Extend the model through ICrestAppsModelConfigurer.await app.Services.InitializeEntityCoreSchemaAsync() after Build() when the host lets the package manage the schema. It runs EnsureCreatedAsync(), upgrades the pre-1.0 layout, and adds optional tables and catalog columns introduced later. Use EF Core migrations instead when the host owns its schema.using CrestApps.Core;
using CrestApps.Core.AI;
using CrestApps.Core.AI.Chat;
using CrestApps.Core.AI.Documents;
using CrestApps.Core.Data.EntityCore;
builder.Services.AddControllersWithViews()
.AddCrestAppsStoreCommitterFilter();
builder.Services.AddCrestAppsCore(crestApps => crestApps
.AddAISuite(ai => ai
.AddEntityCoreStores()
.AddChatInteractions(chat => chat.AddEntityCoreStores())
.AddDocumentProcessing(documents => documents.AddEntityCoreStores())
.AddAIMemory(memory => memory.AddEntityCoreStores())
.AddPersonas(personas => personas.AddEntityCoreStores())
.AddToolInstances(tools => tools.AddEntityCoreStores()))
.AddIndexingServices(indexing => indexing.AddEntityCoreStores())
.AddEntityCoreDataStore(
options => options.UseNpgsql(builder.Configuration.GetConnectionString("CrestApps")),
store => store.TablePrefix = "App_"));
builder.Services.AddCoreWebCrawlerStoresEntityCore();
builder.Services.AddCoreFileSourceStoresEntityCore();
AddEntityCoreStores() also exists on CrestAppsA2AClientBuilder, CrestAppsMcpClientBuilder and CrestAppsMcpServerBuilder.
| Method | Registers |
|---|---|
AddCoreAIServicesStoresEntityCore() | EntityCoreAIProfileStore as IAIProfileStore and every AIProfile catalog interface; writable binding sources for AIProviderConnection and AIDeployment |
AddCoreAIProfileTemplateStoresEntityCore() | AIProfileTemplate named-source catalog |
AddCoreAIPersonaStoresEntityCore() | AIPersona named catalog |
AddCoreAIProfileVersionStoresEntityCore() | EntityCoreAIProfileVersionStore as IAIProfileVersionStore (also AddProfileVersions(v => v.AddEntityCoreStores())) |
AddCoreAIToolInstanceStoresEntityCore() | AIToolInstance named-source catalog |
AddCoreAIA2AClientStoresEntityCore() | A2AConnection catalog |
AddCoreAIMcpClientStoresEntityCore() | McpConnection source catalog |
AddCoreAIMcpServerStoresEntityCore() | McpPrompt named catalog, McpResource source catalog |
AddCoreAIChatSessionStoresEntityCore() | EntityCoreAIChatSessionManager, EntityCoreAIChatSessionStore, EntityCoreAIChatSessionPromptStore, EntityCoreAIChatSessionEventStore, EntityCoreAICompletionUsageStore, and the extracted-data store |
AddCoreAIChatSessionExtractedDataStoresEntityCore() | EntityCoreAIChatSessionExtractedDataStore and the extracted-data recorder |
AddCoreAIChatInteractionStoresEntityCore() | ChatInteraction catalog, EntityCoreChatInteractionPromptStore |
AddCoreAIDocumentProcessingStoresEntityCore() | EntityCoreAIDocumentStore, EntityCoreAIDocumentChunkStore |
AddCoreAIDataSourceStoresEntityCore() | EntityCoreAIDataSourceStore |
AddCoreAIMemoryStoresEntityCore() | EntityCoreAIMemoryStore |
AddCoreIndexingStoresEntityCore() | EntityCoreSearchIndexProfileStore |
AddCoreKnowledgeStoresEntityCore() | EntityCoreKnowledgeObjectStore as IKnowledgeObjectStore |
AddCoreIngestionItemStateStoreEntityCore() | EntityCoreIngestionItemStateStore as IIngestionItemStateStore |
AddCoreWebCrawlerStoresEntityCore() | EntityCoreWebCrawlerStore, EntityCoreWebCrawlStateStore, plus knowledge and ingestion item state |
AddCoreFileSourceStoresEntityCore() | EntityCoreFileSourceStore, plus knowledge and ingestion item state |
services.AddEntityCoreStores() is a one-call shortcut that runs AddCatalogManagers() and the services, tool instance, profile template, A2A, MCP client, MCP server, chat session, document processing, data source, memory, chat interaction and indexing methods. It does not include personas, profile versions, knowledge objects, ingestion item state, web crawlers or file sources; add those explicitly.
CrestAppsEntityDbContext maps Documents, CatalogRecords, AIChatSessions, AIChatSessionEvents, AICompletionUsage and AIChatSessionExtractedData, each prefixed with TablePrefix. Catalog models are stored as JSON in Documents and indexed through CatalogRecords (entity type, item id, name, display text, source, and lookup columns). The context exposes them as Documents, CatalogRecords, AIChatSessionRecords, AIChatSessionEventRecords, AICompletionUsageRecords and AIChatSessionExtractedDataRecords.
Generic catalogs in CrestApps.Core.Data.EntityCore.Services store any CatalogItem in the shared tables with no schema change:
using CrestApps.Core;
using CrestApps.Core.Data.EntityCore.Services;
builder.Services.AddDocumentCatalog<Article, DocumentCatalog<Article>>();
builder.Services.AddNamedDocumentCatalog<TicketCategory, NamedDocumentCatalog<TicketCategory>>();
builder.Services.AddSourceDocumentCatalog<Connector, SourceDocumentCatalog<Connector>>();
builder.Services.AddNamedSourceDocumentCatalog<Widget, NamedSourceDocumentCatalog<Widget>>();
For a model that merges configuration and database entries, register the database side with AddEntityCoreNamedSourceBindingSource<TModel>() (named and source-aware) or AddEntityCoreNamedBindingSource<TModel>() (named only).
using CrestApps.Core.Data.EntityCore;
using Microsoft.EntityFrameworkCore;
namespace MyApp.Data;
public sealed class AuditEntry
{
public int Id { get; set; }
public string ItemId { get; set; }
public DateTime CreatedUtc { get; set; }
}
public sealed class AuditModelConfigurer : ICrestAppsModelConfigurer
{
public void Configure(ModelBuilder modelBuilder, EntityCoreDataStoreOptions options)
{
modelBuilder.Entity<AuditEntry>(entity =>
{
entity.ToTable($"{options.TablePrefix}AuditEntries");
entity.HasKey(entry => entry.Id);
entity.HasIndex(entry => entry.ItemId);
});
}
}
builder.Services.AddSingleton<ICrestAppsModelConfigurer, AuditModelConfigurer>();
Configurers run inside OnModelCreating in registration order. Access the table through dbContext.Set<AuditEntry>(). EnsureCreatedAsync() creates tables only for a new database, so add tables to an existing database with a migration or your own script.
IStoreCommitter.CommitAsync() in background scopes.IKnowledgeObjectStore cannot be resolved: call AddCoreKnowledgeStoresEntityCore() (or a web crawler or file source store method).EnforceNamedSourceUniqueness.AIProfileVersion documents in Documents, with the profile id in the CatalogRecords reference column (ReferenceId, ReferenceType = AIProfile) and the save time in CreatedUtc. No new table.EntityCoreAIChatSessionStore implements the new IAIChatSessionStore.ListByLastActivityAsync and DeleteAsync. A host with its own session store must add both.EntityCoreAIChatSessionManager.PageAsync filters by AIChatSessionQueryContext.UserId when set, and new sessions record the profile's AIProfileVersionMetadata.AIChatSessionQueryContext.ClientId (new) lists one anonymous visitor's sessions; EntityCoreAIChatSessionManager.PageAsync filters on it.EntityCoreAICompletionUsageStore writes and saves each usage record at once in a context of its own (from an IServiceScopeFactory scope), bounded to 30 seconds, instead of adding it to the caller's scoped context. The record is kept when the caller rolls back; reads still use the scoped context. Code that constructs the store passes the new IServiceScopeFactory argument.AddCoreAIPersonaStoresEntityCore(), AddCoreKnowledgeStoresEntityCore(), AddCoreIngestionItemStateStoreEntityCore(), AddCoreWebCrawlerStoresEntityCore(), AddCoreFileSourceStoresEntityCore(), and the persona builder overload.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
crestapps-core, entity-framework-core, persistence, data-store
51 skills in this plugin
/crestapps-core-a2aSkill for Agent-to-Agent (A2A) protocol support in CrestApps.Core on the A2A 1.0 SDK. Covers AddA2AClient and AddCoreAIA2AClient with Entity Framework Core or YesSql connection stores, A2AConnection and A2AConnectionMetadata authentication, AIProfileA2AMetadata, the agent card cache and A2AToolRegistryProvider, the listAvailableAgents, findAgentForTask and findToolsForTask tools, building an A2A host with IAgentHandler, A2AServer, ITaskStore and MapA2A, A2A 1.0 agent cards with supportedInterfaces published at /.well-known/agent-card.json, A2AHostOptions authentication and ExposeAgentsAsSkill, system agents exposed through the host, and upgrading from the 0.3 SDK./crestapps-core-ag-uiSkill for running the CrestApps.Core 2.0 AI chat as an AG-UI agent. Covers the CrestApps.Core.AI.AGUI package (AGUIRunEventWriter, AGUIRunRequest, AGUIJson), AIChatHubCore.RunAgent over SignalR and MapAGUIChat with Server-Sent Events, the RunAgentInput members and streamed events, tool approvals with RequireApproval or an approval tool kind, ApprovalRequiredAIFunction, interrupts and resume, approvals inside agents, page context with crestAppsAGUI.registerContextProvider, shared state with registerStateProvider and update_shared_state, frontend tools, stored tool calls (ChatTurnToolActivity), runs that continue on the next page, AGUIChatOptions.DisconnectedRunTimeout, the protocol and sendPageContext chat options, and the AICompletionContextKeys and ChatResponseHandlerContext members. Use it when showing tool calls in the chat, asking a person before a tool runs, sharing page state with the agent, connecting CopilotKit or another AG-UI client, or troubleshooting approvals and continued runs./crestapps-core:crestapps-core-entitycore-storesfrom crestapps-core
npx claudepluginhub crestapps/crestapps.agentskills --plugin crestapps-coreOther plugins' skills for the same job