{"record":{"id":"0b376604087c3ee3","repo":"dotnet/efcore","slug":"table-name-must-be-specified-to-configure-a-table","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/OwnedNavigationTableBuilder.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(), OwnedNavigationBuilder.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    OwnedNavigationBuilder IInfrastructure<OwnedNavigationBuilder>.Instance\n        => OwnedNavigationBuilder;\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/OwnedNavigationTableBuilder.cs#L146-L182","documentation":"OwnedNavigationTableBuilder.GetStoreObjectIdentifier() returns the builder's StoreObject; if it is null it throws MappingFragmentMissingName. Table-specific property configuration (Property(...)) needs a concrete named table to bind a column override to, so calling it on a builder that has no table name is invalid.","triggerScenarios":"Invoking .Property(\"X\") (or another table-specific method) on an OwnedNavigationTableBuilder whose StoreObject is null — e.g. the builder was obtained without a named table (a default/empty table builder) and you tried to configure a column mapping on it.","commonSituations":"Calling table-specific property config off an OwnedNavigationTableBuilder created for a default mapping; misusing a builder returned before .ToTable(name) was applied; chaining APIs incorrectly.","solutions":["Specify a table name first: .ToTable(\"Address\") (or .ToTable(\"Address\", schema)) so the builder carries a StoreObjectIdentifier.","If you do not need table-specific overrides, use the non-table-specific property configuration on the owned navigation builder directly.","Confirm the OwnedNavigationTableBuilder you are using was produced from a named ToTable call."],"exampleFix":"// before — table builder with no name\nmodelBuilder.Entity<Customer>()\n    .OwnsOne(c => c.Address, a =>\n    {\n        a.ToTable(tb => tb.Property(\"Line1\").HasColumnName(\"AddrLine1\")); // no table name -> [454]\n    });\n\n// after — give the table a name\nmodelBuilder.Entity<Customer>()\n    .OwnsOne(c => c.Address, a =>\n    {\n        a.ToTable(\"CustomerAddress\", tb => tb.Property(a => a.Line1).HasColumnName(\"AddrLine1\"));\n    });","handlingStrategy":"validation","validationCode":"// Ensure a table name is supplied before using 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.","If you do not need table-specific overrides, configure the property on the entity builder directly.","Review builder chaining to confirm the OwnedNavigationTableBuilder came from a named ToTable."],"tags":["table-building","owned-types","metadata","builder"],"backgroundTag":null,"analyzedSha":"3a2006ef569de08368d59db5e1468aa8f407e4f8","analyzedAt":"2026-08-11T23:42:04.146Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}