Struct ConcurrencyToken
- Namespace
- FluentCommand
- Assembly
- FluentCommand.dll
A structure to hold concurrency token
public readonly struct ConcurrencyToken : IEquatable<ConcurrencyToken>
- Implements
- Inherited Members
Remarks
This structure is commonly used to represent SQL Server rowversion
(also known as timestamp
) columns for optimistic concurrency control.
Constructors
ConcurrencyToken(byte[])
Initializes a new instance of the ConcurrencyToken struct.
public ConcurrencyToken(byte[] value)
Parameters
value
byte[]The value.
ConcurrencyToken(long)
Initializes a new instance of the ConcurrencyToken struct from a long value.
public ConcurrencyToken(long value)
Parameters
value
longThe long value.
ConcurrencyToken(string)
Initializes a new instance of the ConcurrencyToken struct.
public ConcurrencyToken(string value)
Parameters
value
stringThe value.
ConcurrencyToken(ulong)
Initializes a new instance of the ConcurrencyToken struct from a ulong value.
public ConcurrencyToken(ulong value)
Parameters
value
ulongThe ulong value.
Fields
None
The default empty token
public static readonly ConcurrencyToken None
Field Value
Properties
Value
Gets the underlying value of the token.
public byte[] Value { get; }
Property Value
- byte[]
The underlying value of the token.
Methods
Equals(ConcurrencyToken)
public bool Equals(ConcurrencyToken other)
Parameters
other
ConcurrencyToken
Returns
Equals(object)
public override bool Equals(object obj)
Parameters
obj
object
Returns
GetHashCode()
public override int GetHashCode()
Returns
ToString()
public override string ToString()
Returns
Operators
operator ==(ConcurrencyToken, ConcurrencyToken)
Determines whether two ConcurrencyToken instances are equal.
public static bool operator ==(ConcurrencyToken left, ConcurrencyToken right)
Parameters
left
ConcurrencyTokenThe first ConcurrencyToken to compare.
right
ConcurrencyTokenThe second ConcurrencyToken to compare.
Returns
- bool
true if the two ConcurrencyToken instances are equal; otherwise, false.
implicit operator byte[](ConcurrencyToken)
Performs an implicit conversion from ConcurrencyToken to byte array.
public static implicit operator byte[](ConcurrencyToken token)
Parameters
token
ConcurrencyTokenThe concurrency token.
Returns
- byte[]
The result of the conversion.
implicit operator long(ConcurrencyToken)
Performs an implicit conversion from ConcurrencyToken to long.
public static implicit operator long(ConcurrencyToken token)
Parameters
token
ConcurrencyTokenThe concurrency token.
Returns
- long
The result of the conversion.
implicit operator string(ConcurrencyToken)
Performs an implicit conversion from ConcurrencyToken to string.
public static implicit operator string(ConcurrencyToken token)
Parameters
token
ConcurrencyTokenThe concurrency token.
Returns
- string
The result of the conversion.
implicit operator ulong(ConcurrencyToken)
Performs an implicit conversion from ConcurrencyToken to ulong.
public static implicit operator ulong(ConcurrencyToken token)
Parameters
token
ConcurrencyTokenThe concurrency token.
Returns
- ulong
The result of the conversion.
implicit operator ConcurrencyToken(byte[])
Performs an implicit conversion from byte array to ConcurrencyToken.
public static implicit operator ConcurrencyToken(byte[] token)
Parameters
token
byte[]The concurrency token.
Returns
- ConcurrencyToken
The result of the conversion.
implicit operator ConcurrencyToken(long)
Performs an implicit conversion from long to ConcurrencyToken.
public static implicit operator ConcurrencyToken(long value)
Parameters
value
longThe long value.
Returns
- ConcurrencyToken
The result of the conversion.
implicit operator ConcurrencyToken(string)
Performs an implicit conversion from string to ConcurrencyToken.
public static implicit operator ConcurrencyToken(string token)
Parameters
token
stringThe concurrency token.
Returns
- ConcurrencyToken
The result of the conversion.
implicit operator ConcurrencyToken(ulong)
Performs an implicit conversion from ulong to ConcurrencyToken.
public static implicit operator ConcurrencyToken(ulong value)
Parameters
value
ulongThe ulong value.
Returns
- ConcurrencyToken
The result of the conversion.
operator !=(ConcurrencyToken, ConcurrencyToken)
Determines whether two ConcurrencyToken instances are not equal.
public static bool operator !=(ConcurrencyToken left, ConcurrencyToken right)
Parameters
left
ConcurrencyTokenThe first ConcurrencyToken to compare.
right
ConcurrencyTokenThe second ConcurrencyToken to compare.
Returns
- bool
true if the two ConcurrencyToken instances are not equal; otherwise, false.