forked from nhibernate/nhibernate-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGuidGenerator.cs
33 lines (30 loc) · 989 Bytes
/
GuidGenerator.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
25
26
27
28
29
30
31
32
33
using System;
using NHibernate.Engine;
namespace NHibernate.Id
{
/// <summary>
/// An <see cref="IIdentifierGenerator" /> that generates <see cref="Guid"/> values
/// using <see cref="System.Guid.NewGuid()">Guid.NewGuid()</see>.
/// </summary>
/// <remarks>
/// <p>
/// This id generation strategy is specified in the mapping file as
/// <code><generator class="guid" /></code>
/// </p>
/// </remarks>
public partial class GuidGenerator : IIdentifierGenerator
{
#region IIdentifierGenerator Members
/// <summary>
/// Generate a new <see cref="Guid"/> for the identifier.
/// </summary>
/// <param name="session">The <see cref="ISessionImplementor"/> this id is being generated in.</param>
/// <param name="obj">The entity for which the id is being generated.</param>
/// <returns>The new identifier as a <see cref="Guid"/>.</returns>
public object Generate(ISessionImplementor session, object obj)
{
return Guid.NewGuid();
}
#endregion
}
}