CoreStrings.KeyAttributeOnDerivedEntity Method

Definition

Overloads

KeyAttributeOnDerivedEntity(Object, Object, Object)

The derived type '{derivedType}' cannot have the [Key] attribute on property '{property}' since primary keys may only be declared on the root type. Move the property '{property}' to '{rootType}' or remove '{rootType}' from the model by using [NotMapped] attribute or calling 'EntityTypeBuilder.Ignore' on the base type in 'OnModelCreating'.

KeyAttributeOnDerivedEntity(Object, Object)

The derived type '{derivedType}' cannot have the [Key] attribute on property '{property}' since primary keys may only be declared on the root type.

KeyAttributeOnDerivedEntity(Object, Object, Object)

Source:
CoreStrings.Designer.cs
Source:
CoreStrings.Designer.cs
Source:
CoreStrings.Designer.cs
Source:
CoreStrings.Designer.cs

The derived type '{derivedType}' cannot have the [Key] attribute on property '{property}' since primary keys may only be declared on the root type. Move the property '{property}' to '{rootType}' or remove '{rootType}' from the model by using [NotMapped] attribute or calling 'EntityTypeBuilder.Ignore' on the base type in 'OnModelCreating'.

C#
public static string KeyAttributeOnDerivedEntity (object? derivedType, object? property, object? rootType);

Parameters

derivedType
Object
property
Object
rootType
Object

Returns

Applies to

Entity Framework Core 9.0 and other versions
Product Versions
Entity Framework Core 6.0, 7.0, 8.0, 9.0

KeyAttributeOnDerivedEntity(Object, Object)

Source:
CoreStrings.Designer.cs
Source:
CoreStrings.Designer.cs
Source:
CoreStrings.Designer.cs

The derived type '{derivedType}' cannot have the [Key] attribute on property '{property}' since primary keys may only be declared on the root type.

C#
public static string KeyAttributeOnDerivedEntity (object derivedType, object property);

Parameters

derivedType
Object
property
Object

Returns

Applies to

Entity Framework Core 5.0 and other versions
Product Versions
Entity Framework Core 3.0, 3.1, 5.0