DbContextId Struct

Definition

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

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.

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

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.

When context pooling is being used, then this ID must be combined with the Lease in order to get a unique ID for the effective instance being used.

Lease

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

Will be zero if context pooling is not being used.

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 fully qualified type name of this instance.

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