CosmosEntityTypeBuilderExtensions.HasPartitionKey Method

Definition

Overloads

HasPartitionKey(EntityTypeBuilder, String)

Configures the property that is used to store the partition key.

HasPartitionKey(IConventionEntityTypeBuilder, String, Boolean)

Configures the property that is used to store the partition key.

HasPartitionKey<TEntity,TProperty>(EntityTypeBuilder<TEntity>, Expression<Func<TEntity,TProperty>>)

Configures the property that is used to store the partition key.

HasPartitionKey<TEntity>(EntityTypeBuilder<TEntity>, String)

Configures the property that is used to store the partition key.

HasPartitionKey(EntityTypeBuilder, String)

Configures the property that is used to store the partition key.

public static Microsoft.EntityFrameworkCore.Metadata.Builders.EntityTypeBuilder HasPartitionKey (this Microsoft.EntityFrameworkCore.Metadata.Builders.EntityTypeBuilder entityTypeBuilder, string name);
public static Microsoft.EntityFrameworkCore.Metadata.Builders.EntityTypeBuilder HasPartitionKey (this Microsoft.EntityFrameworkCore.Metadata.Builders.EntityTypeBuilder entityTypeBuilder, string? name);
static member HasPartitionKey : Microsoft.EntityFrameworkCore.Metadata.Builders.EntityTypeBuilder * string -> Microsoft.EntityFrameworkCore.Metadata.Builders.EntityTypeBuilder
<Extension()>
Public Function HasPartitionKey (entityTypeBuilder As EntityTypeBuilder, name As String) As EntityTypeBuilder

Parameters

entityTypeBuilder
EntityTypeBuilder

The builder for the entity type being configured.

name
String

The name of the partition key property.

Returns

The same builder instance so that multiple calls can be chained.

Remarks

See Modeling entity types and relationships, and Accessing Azure Cosmos DB with EF Core for more information and examples.

Applies to

HasPartitionKey(IConventionEntityTypeBuilder, String, Boolean)

Configures the property that is used to store the partition key.

public static Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionEntityTypeBuilder HasPartitionKey (this Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionEntityTypeBuilder entityTypeBuilder, string name, bool fromDataAnnotation = false);
public static Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionEntityTypeBuilder? HasPartitionKey (this Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionEntityTypeBuilder entityTypeBuilder, string? name, bool fromDataAnnotation = false);
static member HasPartitionKey : Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionEntityTypeBuilder * string * bool -> Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionEntityTypeBuilder
<Extension()>
Public Function HasPartitionKey (entityTypeBuilder As IConventionEntityTypeBuilder, name As String, Optional fromDataAnnotation As Boolean = false) As IConventionEntityTypeBuilder

Parameters

entityTypeBuilder
IConventionEntityTypeBuilder

The builder for the entity type being configured.

name
String

The name of the partition key property.

fromDataAnnotation
Boolean

Indicates whether the configuration was specified using a data annotation.

Returns

The same builder instance if the configuration was applied, null otherwise.

Remarks

See Modeling entity types and relationships, and Accessing Azure Cosmos DB with EF Core for more information and examples.

Applies to

HasPartitionKey<TEntity,TProperty>(EntityTypeBuilder<TEntity>, Expression<Func<TEntity,TProperty>>)

Configures the property that is used to store the partition key.

public static Microsoft.EntityFrameworkCore.Metadata.Builders.EntityTypeBuilder<TEntity> HasPartitionKey<TEntity,TProperty> (this Microsoft.EntityFrameworkCore.Metadata.Builders.EntityTypeBuilder<TEntity> entityTypeBuilder, System.Linq.Expressions.Expression<Func<TEntity,TProperty>> propertyExpression) where TEntity : class;
static member HasPartitionKey : Microsoft.EntityFrameworkCore.Metadata.Builders.EntityTypeBuilder<'Entity (requires 'Entity : null)> * System.Linq.Expressions.Expression<Func<'Entity, 'Property>> -> Microsoft.EntityFrameworkCore.Metadata.Builders.EntityTypeBuilder<'Entity (requires 'Entity : null)> (requires 'Entity : null)
<Extension()>
Public Function HasPartitionKey(Of TEntity As Class, TProperty As Class) (entityTypeBuilder As EntityTypeBuilder(Of TEntity), propertyExpression As Expression(Of Func(Of TEntity, TProperty))) As EntityTypeBuilder(Of TEntity)

Type Parameters

TEntity
TProperty

Parameters

entityTypeBuilder
EntityTypeBuilder<TEntity>

The builder for the entity type being configured.

propertyExpression
Expression<Func<TEntity,TProperty>>

The partition key property.

Returns

The same builder instance so that multiple calls can be chained.

Remarks

See Modeling entity types and relationships, and Accessing Azure Cosmos DB with EF Core for more information and examples.

Applies to

HasPartitionKey<TEntity>(EntityTypeBuilder<TEntity>, String)

Configures the property that is used to store the partition key.

public static Microsoft.EntityFrameworkCore.Metadata.Builders.EntityTypeBuilder<TEntity> HasPartitionKey<TEntity> (this Microsoft.EntityFrameworkCore.Metadata.Builders.EntityTypeBuilder<TEntity> entityTypeBuilder, string name) where TEntity : class;
public static Microsoft.EntityFrameworkCore.Metadata.Builders.EntityTypeBuilder<TEntity> HasPartitionKey<TEntity> (this Microsoft.EntityFrameworkCore.Metadata.Builders.EntityTypeBuilder<TEntity> entityTypeBuilder, string? name) where TEntity : class;
static member HasPartitionKey : Microsoft.EntityFrameworkCore.Metadata.Builders.EntityTypeBuilder<'Entity (requires 'Entity : null)> * string -> Microsoft.EntityFrameworkCore.Metadata.Builders.EntityTypeBuilder<'Entity (requires 'Entity : null)> (requires 'Entity : null)
<Extension()>
Public Function HasPartitionKey(Of TEntity As Class) (entityTypeBuilder As EntityTypeBuilder(Of TEntity), name As String) As EntityTypeBuilder(Of TEntity)

Type Parameters

TEntity

Parameters

entityTypeBuilder
EntityTypeBuilder<TEntity>

The builder for the entity type being configured.

name
String

The name of the partition key property.

Returns

The same builder instance so that multiple calls can be chained.

Remarks

See Modeling entity types and relationships, and Accessing Azure Cosmos DB with EF Core for more information and examples.

Applies to