CosmosEntityTypeBuilderExtensions.HasPartitionKey Method

Definition

Overloads

HasPartitionKey(EntityTypeBuilder, String)

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

HasPartitionKey(EntityTypeBuilder, String, String[])

Configures the properties that are used to store the parts of a simple or hierarchical partition key.

HasPartitionKey(IConventionEntityTypeBuilder, IReadOnlyList<String>, Boolean)

Configures the properties that are used to store the parts of a hierarchical partition key.

HasPartitionKey(IConventionEntityTypeBuilder, String, Boolean)
Obsolete.

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

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

Configures the properties that are used to store the parts of a simple or hierarchical partition key.

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

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

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

Configures the properties that are used to store the parts of a simple or hierarchical partition key.

HasPartitionKey(EntityTypeBuilder, String)

Source:
CosmosEntityTypeBuilderExtensions.cs
Source:
CosmosEntityTypeBuilderExtensions.cs
Source:
CosmosEntityTypeBuilderExtensions.cs
Source:
CosmosEntityTypeBuilderExtensions.cs
Source:
CosmosEntityTypeBuilderExtensions.cs
Source:
CosmosEntityTypeBuilderExtensions.cs

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(EntityTypeBuilder, String, String[])

Source:
CosmosEntityTypeBuilderExtensions.cs

Configures the properties that are used to store the parts of a simple or hierarchical partition key.

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

Parameters

entityTypeBuilder
EntityTypeBuilder

The builder for the entity type being configured.

name
String

The name of the first or only partition key property.

additionalPropertyNames
String[]

The names of additional properties that will form a hierarchical partition key.

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, IReadOnlyList<String>, Boolean)

Source:
CosmosEntityTypeBuilderExtensions.cs

Configures the properties that are used to store the parts of a hierarchical partition key.

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

Parameters

entityTypeBuilder
IConventionEntityTypeBuilder

The builder for the entity type being configured.

propertyNames
IReadOnlyList<String>

The names of the properties that will form the hierarchical partition key.

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(IConventionEntityTypeBuilder, String, Boolean)

Source:
CosmosEntityTypeBuilderExtensions.cs
Source:
CosmosEntityTypeBuilderExtensions.cs
Source:
CosmosEntityTypeBuilderExtensions.cs
Source:
CosmosEntityTypeBuilderExtensions.cs
Source:
CosmosEntityTypeBuilderExtensions.cs
Source:
CosmosEntityTypeBuilderExtensions.cs
Source:
CosmosEntityTypeBuilderExtensions.cs

Caution

Use HasPartitionKey(IReadOnlyList<string>, bool)

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);
[System.Obsolete("Use HasPartitionKey(IReadOnlyList<string>, bool)")]
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
[<System.Obsolete("Use HasPartitionKey(IReadOnlyList<string>, bool)")>]
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.

Attributes

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>>)

Source:
CosmosEntityTypeBuilderExtensions.cs
Source:
CosmosEntityTypeBuilderExtensions.cs
Source:
CosmosEntityTypeBuilderExtensions.cs
Source:
CosmosEntityTypeBuilderExtensions.cs
Source:
CosmosEntityTypeBuilderExtensions.cs
Source:
CosmosEntityTypeBuilderExtensions.cs
Source:
CosmosEntityTypeBuilderExtensions.cs

Configures the properties that are used to store the parts of a simple or hierarchical 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 properties that will form the partition key.

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)

Source:
CosmosEntityTypeBuilderExtensions.cs
Source:
CosmosEntityTypeBuilderExtensions.cs
Source:
CosmosEntityTypeBuilderExtensions.cs
Source:
CosmosEntityTypeBuilderExtensions.cs
Source:
CosmosEntityTypeBuilderExtensions.cs
Source:
CosmosEntityTypeBuilderExtensions.cs

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

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

Source:
CosmosEntityTypeBuilderExtensions.cs

Configures the properties that are used to store the parts of a simple or hierarchical partition key.

public static Microsoft.EntityFrameworkCore.Metadata.Builders.EntityTypeBuilder<TEntity> HasPartitionKey<TEntity> (this Microsoft.EntityFrameworkCore.Metadata.Builders.EntityTypeBuilder<TEntity> entityTypeBuilder, string? name, params string[]? additionalPropertyNames) where TEntity : class;
static member HasPartitionKey : Microsoft.EntityFrameworkCore.Metadata.Builders.EntityTypeBuilder<'Entity (requires 'Entity : null)> * string * 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, ParamArray additionalPropertyNames 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 first or only partition key property.

additionalPropertyNames
String[]

The names of additional properties that will form a hierarchical partition key.

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