IStronglyTypedId Interface

Provides non-generic access to a strongly-typed ID's underlying value as a string and its type information.

public interface IStronglyTypedId

Example

Working with strongly-typed IDs polymorphically:

[StronglyTypedId(typeof(int))]
public partial struct UserId
{
}
var userId = UserId.FromInt32(42);
IStronglyTypedId stronglyTypedId = userId;
Assert.Equal("42", stronglyTypedId.ValueAsString);
Assert.Equal(typeof(int), stronglyTypedId.UnderlyingType);

Properties

NameDescription
UnderlyingTypeGets the underlying type of the strongly-typed ID value.
ValueAsStringGets the underlying value as a string representation.

UnderlyingType

Gets the underlying type of the strongly-typed ID value.

Type UnderlyingType { get; }

Property value

Type

ValueAsString

Gets the underlying value as a string representation.

string ValueAsString { get; }

Property value

string