-
Notifications
You must be signed in to change notification settings - Fork 934
/
Copy pathIdentityGenerator.cs
42 lines (39 loc) · 1.35 KB
/
IdentityGenerator.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
34
35
36
37
38
39
40
41
42
using NHibernate.Engine;
namespace NHibernate.Id
{
/// <summary>
/// An <see cref="IIdentifierGenerator" /> that indicates to the <see cref="ISession"/> that identity
/// (ie. identity/autoincrement column) key generation should be used.
/// </summary>
/// <remarks>
/// <p>
/// This id generation strategy is specified in the mapping file as
/// <code><generator class="identity" /></code>
/// or if the database natively supports identity columns
/// <code><generator class="native" /></code>
/// </p>
/// <p>
/// This indicates to NHibernate that the database generates the id when
/// the entity is inserted.
/// </p>
/// </remarks>
public class IdentityGenerator : IIdentifierGenerator
{
#region IIdentifierGenerator Members
/// <summary>
/// The IdentityGenerator for autoincrement/identity key generation.
///
/// </summary>
/// <param name="s">The <see cref="ISessionImplementor"/> this id is being generated in.</param>
/// <param name="obj">The entity the id is being generated for.</param>
/// <returns>
/// <c>IdentityColumnIndicator</c> Indicates to the Session that identity (i.e. identity/autoincrement column)
/// key generation should be used.
/// </returns>
public object Generate(ISessionImplementor s, object obj)
{
return IdentifierGeneratorFactory.IdentityColumnIndicator;
}
#endregion
}
}