-
Notifications
You must be signed in to change notification settings - Fork 0
UtilityExtensions.CreateGuid.K4QK8HZXCL8NC8QL1WC6Q8BJ2
Mike King edited this page Oct 29, 2025
·
1 revision
Create a Guid that is suitable for use as a database key value.
public static System.Guid CreateGuid(this Microsoft.EntityFrameworkCore.Infrastructure.DatabaseFacade database);database Microsoft.EntityFrameworkCore.Infrastructure.DatabaseFacade
The Microsoft.EntityFrameworkCore.Infrastructure.DatabaseFacade for the context.
SQL Server can store GUIDs but because of how they are handled Version 7 GUIDs are not sorted in the correct order (V7 GUIDs contain a timestamp). This method uses a third party library (UUIDNext) to create GUIDS that are compatible with the supported database types.