Skip to content

NH-3759 - uuid.hex id generator fix in mapping by code. Parameters added and retur... #396

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 22, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 25 additions & 3 deletions src/NHibernate/Mapping/ByCode/Generators.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,19 +91,41 @@ public class UUIDHexGeneratorDef : IGeneratorDef
{
#region Implementation of IGeneratorDef

private readonly object param;

public UUIDHexGeneratorDef()
{
}

public UUIDHexGeneratorDef(string format)
{
if (format == null)
throw new ArgumentNullException("format");
param = new { format = format };
}

public UUIDHexGeneratorDef(string format, string separator)
{
if (format == null)
throw new ArgumentNullException("format");
if (separator == null)
throw new ArgumentNullException("separator");
param = new { format = format, seperator = separator };
}

public string Class
{
get { return "uuid.hex"; }
}

public object Params
{
get { return null; }
get { return param; }
}

public System.Type DefaultReturnType
{
get { return typeof(Guid); }
get { return typeof(string); }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the uuid.hex generator returns a string not a guid. Am I missing something?

}

public bool SupportedAsCollectionElementId
Expand Down Expand Up @@ -630,4 +652,4 @@ public bool SupportedAsCollectionElementId
}
#endregion
}
}
}