Skip to content

Commit 182e05c

Browse files
committed
Merge branch 'user-type-convention' of git://github.com/WalkerCodeRanger/fluent-nhibernate into issue172
2 parents a94796c + 70aa5ee commit 182e05c

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/FluentNHibernate/Conventions/UserTypeConvention.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,14 @@ public abstract class UserTypeConvention<TUserType> : IUserTypeConvention
1818
public virtual void Accept(IAcceptanceCriteria<IPropertyInspector> criteria)
1919
{
2020
var userType = Activator.CreateInstance<TUserType>();
21-
22-
criteria.Expect(x => x.Type == userType.ReturnedType);
21+
var returnedType = userType.ReturnedType;
22+
if (returnedType.IsValueType)
23+
{
24+
var nullableReturnedType = typeof(Nullable<>).MakeGenericType(returnedType);
25+
criteria.Expect(x => x.Type == returnedType || x.Type == nullableReturnedType);
26+
}
27+
else
28+
criteria.Expect(x => x.Type == returnedType);
2329
}
2430

2531
public virtual void Apply(IPropertyInstance instance)

0 commit comments

Comments
 (0)