Share via


DbContextId Struct

Definition

A unique identifier for the context instance and pool lease, if any.

[System.Runtime.CompilerServices.IsReadOnly]
public readonly struct DbContextId
public readonly struct DbContextId
[<System.Runtime.CompilerServices.IsReadOnly>]
type DbContextId = struct
type DbContextId = struct
Public Structure DbContextId
Inheritance
DbContextId
Attributes

Remarks

This identifier is primarily intended as a correlation ID for logging and debugging such that it is easy to identify that multiple events are using the same or different context instances.

See DbContext lifetime, configuration, and initialization for more information and examples.

Constructors

DbContextId(Guid, Int32)

Creates a new DbContextId with the given InstanceId and lease number.

Properties

InstanceId

A unique identifier for the DbContext being used.

Lease

A number that is incremented each time this particular DbContext instance is leased from the context pool.

Methods

Equals(DbContextId)

Compares this ID to another ID to see if they represent the same leased context.

Equals(Object)

Compares this ID to another ID to see if they represent the same leased context.

GetHashCode()

A hash code for this ID.

ToString()

Returns the instance ID and lease number.

Operators

Equality(DbContextId, DbContextId)

Compares one ID to another ID to see if they represent the same leased context.

Inequality(DbContextId, DbContextId)

Compares one ID to another ID to see if they represent different leased contexts.

Applies to