{"record":{"id":"16eae5e3c083182f","repo":"dotnet/efcore","slug":"the-entity-type-entitytype-was-configured-to-u-16eae5","errorCode":null,"errorMessage":"The entity type '{entityType}' was configured to use '{sproc}', but the store name was not specified. Configure the stored procedure name explicitly.","messagePattern":"The entity type '(.+?)' was configured to use '(.+?)', but the store name was not specified\\. Configure the stored procedure name explicitly\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/EFCore.Relational/Infrastructure/RelationalModelValidator.cs","lineNumber":519,"sourceCode":"            sprocCount++;\n        }\n\n        if (sprocCount > 0\n            // TODO: Support this with #28703\n            //&& sprocCount < 3\n            && entityType.GetTableName() == null)\n        {\n            throw new InvalidOperationException(RelationalStrings.StoredProcedureUnmapped(entityType.DisplayName()));\n        }\n\n        static void ValidateStoredProcedureName(\n            StoreObjectType storedProcedureType,\n            IEntityType entityType)\n        {\n            var sprocId = StoreObjectIdentifier.Create(entityType, storedProcedureType);\n            if (sprocId == null)\n            {\n                throw new InvalidOperationException(\n                    RelationalStrings.StoredProcedureNoName(\n                        entityType.DisplayName(), storedProcedureType));\n            }\n        }\n    }\n\n    /// <summary>\n    ///     Validates a single stored procedure and all entity types mapped to it.\n    /// </summary>\n    /// <param name=\"mappedTypes\">The entity types mapped to the stored procedure.</param>\n    /// <param name=\"storedProcedure\">The stored procedure identifier.</param>\n    /// <param name=\"logger\">The logger to use.</param>\n    protected virtual void ValidateStoredProcedure(\n        IReadOnlyList<IEntityType> mappedTypes,\n        in StoreObjectIdentifier storedProcedure,\n        IDiagnosticsLogger<DbLoggerCategory.Model.Validation> logger)\n        => ValidateStoredProcedureCompatibility(mappedTypes, storedProcedure, logger);\n","sourceCodeStart":501,"sourceCodeEnd":537,"githubUrl":"https://github.com/dotnet/efcore/blob/dbf9771522148d61a2467854921bd5dc6f6e6916/src/EFCore.Relational/Infrastructure/RelationalModelValidator.cs#L501-L537","documentation":"Thrown when StoreObjectIdentifier.Create cannot determine a name for a stored procedure, i.e. no store name was specified and none can be derived. Each stored procedure mapping requires an explicit name (or a default table name to derive from). The validator fails fast inside ValidateStoredProcedureName when sprocId is null.","triggerScenarios":"Calling .InsertStoredProcedure() (parameterless) on an entity that has no table name set; configuring an UpdateStoredProcedure without a name and with no ToTable default.","commonSituations":"Relying on convention naming that does not apply; forgetting the name argument after switching to name-required sproc APIs.","solutions":["Pass an explicit name: .InsertStoredProcedure(\"sp_InsertBlog\").","Or set a table name via ToTable so the sproc name can be derived by convention.","Provide names for all three (insert/update/delete) sproc configurations."],"exampleFix":"// before\nmodelBuilder.Entity<Blog>()\n    .ToTable((string)null)\n    .InsertStoredProcedure();\n\n// after\nmodelBuilder.Entity<Blog>()\n    .InsertStoredProcedure(\"sp_InsertBlog\");","handlingStrategy":"validation","validationCode":"foreach (var et in modelBuilder.Model.GetEntityTypes())\n{\n    foreach (var t in new[] { StoreObjectType.InsertStoredProcedure, StoreObjectType.UpdateStoredProcedure, StoreObjectType.DeleteStoredProcedure })\n    {\n        var sproc = t switch { StoreObjectType.InsertStoredProcedure => et.GetInsertStoredProcedure(), StoreObjectType.UpdateStoredProcedure => et.GetUpdateStoredProcedure(), _ => et.GetDeleteStoredProcedure() };\n        if (sproc != null && StoreObjectIdentifier.Create(et, t) == null)\n            throw new InvalidOperationException($\"{et.DisplayName()} {t} has no store name\");\n    }\n}","typeGuard":null,"tryCatchPattern":"try { _ = ctx.Model; } catch (InvalidOperationException ex) when (ex.Message.Contains(\"store name was not specified\")) { /* pass explicit sproc names */ }","preventionTips":["Always pass an explicit name to InsertStoredProcedure/UpdateStoredProcedure/DeleteStoredProcedure.","Do not null out the table name when relying on sproc-name convention."],"tags":["ef-core","stored-procedures","naming","model-validation","configuration"],"analyzedSha":"dbf9771522148d61a2467854921bd5dc6f6e6916","analyzedAt":"2026-08-06T20:46:03.226Z","schemaVersion":2},"datasetVersion":"2026-08-07T03:17:09.362Z"}