{"record":{"id":"5aac247493b8b0a7","repo":"dotnet/efcore","slug":"table-name-must-be-specified-to-configure-a-table-5aac24","errorCode":null,"errorMessage":"Table name must be specified to configure a table-specific property mapping.","messagePattern":"Table name must be specified to configure a table-specific property mapping\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/EFCore.Relational/Metadata/Builders/TableBuilder.cs","lineNumber":164,"sourceCode":"    /// <summary>\n    ///     Maps the property to a column on the current table and returns an object that can be used\n    ///     to provide table-specific configuration if the property is mapped to more than one table.\n    /// </summary>\n    /// <typeparam name=\"TProperty\">The type of the property to be configured.</typeparam>\n    /// <param name=\"propertyName\">The name of the property to be configured.</param>\n    /// <returns>An object that can be used to configure the property.</returns>\n    public virtual ColumnBuilder<TProperty> Property<TProperty>(string propertyName)\n        => new(GetStoreObjectIdentifier(), EntityTypeBuilder.Property<TProperty>(propertyName));\n\n    /// <summary>\n    ///     This is an internal API that supports the Entity Framework Core infrastructure and not subject to\n    ///     the same compatibility standards as public APIs. It may be changed or removed without notice in\n    ///     any release. You should only use it directly in your code with extreme caution and knowing that\n    ///     doing so can result in application failures when updating to a new Entity Framework Core release.\n    /// </summary>\n    [EntityFrameworkInternal]\n    protected virtual StoreObjectIdentifier GetStoreObjectIdentifier()\n        => StoreObject ?? throw new InvalidOperationException(RelationalStrings.MappingFragmentMissingName);\n\n    EntityTypeBuilder IInfrastructure<EntityTypeBuilder>.Instance\n        => EntityTypeBuilder;\n\n    #region Hidden System.Object members\n\n    /// <summary>\n    ///     Returns a string that represents the current object.\n    /// </summary>\n    /// <returns>A string that represents the current object.</returns>\n    [EditorBrowsable(EditorBrowsableState.Never)]\n    public override string? ToString()\n        => base.ToString();\n\n    /// <summary>\n    ///     Determines whether the specified object is equal to the current object.\n    /// </summary>\n    /// <param name=\"obj\">The object to compare with the current object.</param>","sourceCodeStart":146,"sourceCodeEnd":182,"githubUrl":"https://github.com/dotnet/efcore/blob/3a2006ef569de08368d59db5e1468aa8f407e4f8/src/EFCore.Relational/Metadata/Builders/TableBuilder.cs#L146-L182","documentation":"TableBuilder.GetStoreObjectIdentifier() returns the builder's StoreObject; if null it throws MappingFragmentMissingName. Table-specific property configuration (Property(...)) requires a concrete named table to bind a column override to, so calling it on a TableBuilder that has no table name is invalid.","triggerScenarios":"Calling .Property(\"X\") on a TableBuilder whose StoreObject is null — e.g. a default/unspecified table builder used without a named ToTable, or a table builder obtained through a path that never assigned a name.","commonSituations":"Invoking table-specific column overrides before .ToTable(name); misuse of a generic/default TableBuilder; refactoring that dropped the ToTable name.","solutions":["Provide a table name: .ToTable(\"Orders\", tb => tb.Property(o => o.Id).HasColumnName(\"OrderId\")).","If table-specific overrides are not needed, configure the property on the entity builder directly (modelBuilder.Entity<T>().Property(...)).","Make sure the TableBuilder you call .Property on came from a named ToTable overload."],"exampleFix":"// before\nmodelBuilder.Entity<Order>()\n    .ToTable(tb => tb.Property(\"Id\").HasColumnName(\"OrderId\")); // no table name -> [456]\n\n// after\nmodelBuilder.Entity<Order>()\n    .ToTable(\"Orders\", tb => tb.Property(o => o.Id).HasColumnName(\"OrderId\"));","handlingStrategy":"validation","validationCode":"// Ensure a table name is supplied before table-specific property config.\nif (string.IsNullOrEmpty(tableName))\n    throw new InvalidOperationException(\"A table name is required for table-specific property mapping.\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always call .ToTable(name, ...) before configuring table-specific columns.","Use the non-table-specific property builder when overrides are not needed.","Confirm the TableBuilder came from a named ToTable overload."],"tags":["table-building","metadata","builder"],"backgroundTag":null,"analyzedSha":"3a2006ef569de08368d59db5e1468aa8f407e4f8","analyzedAt":"2026-08-11T23:42:04.146Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}