IConventionEntityTypeBuilder.HasNoKey Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
HasNoKey(Boolean) |
Configures the entity type to have no keys. It will only be usable for queries. |
HasNoKey(IConventionKey, Boolean) |
Removes a primary or alternate key from this entity type. |
HasNoKey(IReadOnlyList<IConventionProperty>, Boolean) |
Removes a primary or alternate key from this entity type. |
HasNoKey(Boolean)
Configures the entity type to have no keys. It will only be usable for queries.
public Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionEntityTypeBuilder HasNoKey (bool fromDataAnnotation = false);
public Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionEntityTypeBuilder? HasNoKey (bool fromDataAnnotation = false);
abstract member HasNoKey : bool -> Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionEntityTypeBuilder
Public Function HasNoKey (Optional fromDataAnnotation As Boolean = false) As IConventionEntityTypeBuilder
Parameters
- fromDataAnnotation
- Boolean
Indicates whether the configuration was specified using a data annotation.
Returns
The same builder instance if the entity type was configured as keyless,
null
otherwise.
Applies to
HasNoKey(IConventionKey, Boolean)
Removes a primary or alternate key from this entity type.
public Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionEntityTypeBuilder HasNoKey (Microsoft.EntityFrameworkCore.Metadata.IConventionKey key, bool fromDataAnnotation = false);
public Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionEntityTypeBuilder? HasNoKey (Microsoft.EntityFrameworkCore.Metadata.IConventionKey key, bool fromDataAnnotation = false);
abstract member HasNoKey : Microsoft.EntityFrameworkCore.Metadata.IConventionKey * bool -> Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionEntityTypeBuilder
Public Function HasNoKey (key As IConventionKey, Optional fromDataAnnotation As Boolean = false) As IConventionEntityTypeBuilder
Parameters
- key
- IConventionKey
The key to be removed.
- fromDataAnnotation
- Boolean
Indicates whether the configuration was specified using a data annotation.
Returns
The same builder instance if the key was removed,
null
otherwise.
Applies to
HasNoKey(IReadOnlyList<IConventionProperty>, Boolean)
Removes a primary or alternate key from this entity type.
public Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionEntityTypeBuilder HasNoKey (System.Collections.Generic.IReadOnlyList<Microsoft.EntityFrameworkCore.Metadata.IConventionProperty> properties, bool fromDataAnnotation = false);
public Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionEntityTypeBuilder? HasNoKey (System.Collections.Generic.IReadOnlyList<Microsoft.EntityFrameworkCore.Metadata.IConventionProperty> properties, bool fromDataAnnotation = false);
abstract member HasNoKey : System.Collections.Generic.IReadOnlyList<Microsoft.EntityFrameworkCore.Metadata.IConventionProperty> * bool -> Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionEntityTypeBuilder
Public Function HasNoKey (properties As IReadOnlyList(Of IConventionProperty), Optional fromDataAnnotation As Boolean = false) As IConventionEntityTypeBuilder
Parameters
- properties
- IReadOnlyList<IConventionProperty>
The properties that make up the key.
- fromDataAnnotation
- Boolean
Indicates whether the configuration was specified using a data annotation.
Returns
The key that was removed.
Applies to
Entity Framework