If the parameter can be null on the T-Sql side, then I think Guid?
is a more natural fit. Especially when used with ADO.NET parameterized queries, nullable types are conveniently translated to DBNull.Value
when their value is null
. If you were to use Guid.Empty
to indicate null, then you'd need to check for that condition and explicitly pass DBNull.Value
to your command/query. E.g.:
command.Parameters.AddWithValue("@guid", myNullableGuid)
vs.
command.Parameters.AddWithValue("@guid",
myGuid == Guid.Empty ? DBNull.Value : myGuid)
There is virtually no performance difference between the two alternatives, otherwise.