Skip to content

UtilityExtensions.CreateGuid.K4QK8HZXCL8NC8QL1WC6Q8BJ2

Mike King edited this page Oct 29, 2025 · 1 revision

UtilityExtensions.CreateGuid(this DatabaseFacade) Method

Create a Guid that is suitable for use as a database key value.

public static System.Guid CreateGuid(this Microsoft.EntityFrameworkCore.Infrastructure.DatabaseFacade database);

Parameters

database Microsoft.EntityFrameworkCore.Infrastructure.DatabaseFacade

The Microsoft.EntityFrameworkCore.Infrastructure.DatabaseFacade for the context.

Returns

System.Guid
A System.Guid.

Remarks

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.

Clone this wiki locally