generated from Avanade/avanade-template
-
Notifications
You must be signed in to change notification settings - Fork 1
/
GuidIdentifierGenerator.cs
24 lines (21 loc) · 1.02 KB
/
GuidIdentifierGenerator.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// Copyright (c) Avanade. Licensed under the MIT License. See https://github.com/Avanade/DbEx
using System;
using System.Threading;
using System.Threading.Tasks;
namespace DbEx.Migration.Data
{
/// <summary>
/// Represents a <see cref="Guid"/>-based generator that will return a <see cref="Guid.NewGuid"/> for <see cref="IIdentifierGenerator.GenerateGuidIdentifierAsync"/> and <see cref="IIdentifierGenerator.GenerateStringIdentifierAsync"/>.
/// </summary>
public class GuidIdentifierGenerator : IIdentifierGenerator
{
/// <summary>
/// Generate a new <see cref="string"/> identifier.
/// </summary>
public Task<string> GenerateStringIdentifierAsync(CancellationToken cancellation = default) => Task.FromResult(Guid.NewGuid().ToString());
/// <summary>
/// Generate a new <see cref="Guid"/> identifier.
/// </summary>
public Task<Guid> GenerateGuidIdentifierAsync(CancellationToken cancellation = default) => Task.FromResult(Guid.NewGuid());
}
}