Skip to content

Commit 7c8a0ff

Browse files
committed
Merge pull request #396 from lnu/uuidhex
uuid.hex id generator fix in mapping by code. Parameters added and retur...
2 parents 262ac22 + f93fa05 commit 7c8a0ff

File tree

1 file changed

+25
-3
lines changed

1 file changed

+25
-3
lines changed

src/NHibernate/Mapping/ByCode/Generators.cs

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,19 +91,41 @@ public class UUIDHexGeneratorDef : IGeneratorDef
9191
{
9292
#region Implementation of IGeneratorDef
9393

94+
private readonly object param;
95+
96+
public UUIDHexGeneratorDef()
97+
{
98+
}
99+
100+
public UUIDHexGeneratorDef(string format)
101+
{
102+
if (format == null)
103+
throw new ArgumentNullException("format");
104+
param = new { format = format };
105+
}
106+
107+
public UUIDHexGeneratorDef(string format, string separator)
108+
{
109+
if (format == null)
110+
throw new ArgumentNullException("format");
111+
if (separator == null)
112+
throw new ArgumentNullException("separator");
113+
param = new { format = format, seperator = separator };
114+
}
115+
94116
public string Class
95117
{
96118
get { return "uuid.hex"; }
97119
}
98120

99121
public object Params
100122
{
101-
get { return null; }
123+
get { return param; }
102124
}
103125

104126
public System.Type DefaultReturnType
105127
{
106-
get { return typeof(Guid); }
128+
get { return typeof(string); }
107129
}
108130

109131
public bool SupportedAsCollectionElementId
@@ -630,4 +652,4 @@ public bool SupportedAsCollectionElementId
630652
}
631653
#endregion
632654
}
633-
}
655+
}

0 commit comments

Comments
 (0)