Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
govorovvs committed Nov 16, 2017
1 parent 04ea60e commit c366f6a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public void TypeShouldntBeOverwritten()

Convention(x => x.CustomType<int>());

VerifyModel(x => x.Type.Name.ShouldEqual(typeof(CustomUserType).AssemblyQualifiedName));
VerifyModel(x => x.Type.GetUnderlyingSystemType().ShouldEqual(typeof(CustomUserType)));
}

[Test]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public void EnumsDontGetTypeOverriddenByConventionsIfExplicitlySet()
{
new MappingTester<MappedObject>()
.ForMapping(m => m.Map(x => x.Color).CustomType(typeof(int)))
.Element("class/property[@name='Color']").HasAttribute("type", typeof(int).Name);
.Element("class/property[@name='Color']").HasAttribute("type", typeof(int).AssemblyQualifiedName);
}
}
}
12 changes: 5 additions & 7 deletions src/FluentNHibernate/Mapping/PropertyPart.cs
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,9 @@ public PropertyPart CustomType(Type type)
if (typeof(ICompositeUserType).IsAssignableFrom(type))
AddColumnsFromCompositeUserType(type);

return CustomType(TypeMapping.GetTypeString(type));
attributes.Set("Type", Layer.UserSupplied, new TypeReference(type));

return this;
}

/// <summary>
Expand All @@ -206,11 +208,7 @@ public PropertyPart CustomType(string type)
public PropertyPart CustomType(Func<Type, Type> typeFunc)
{
var type = typeFunc.Invoke(member.PropertyType);

if (typeof(ICompositeUserType).IsAssignableFrom(type))
AddColumnsFromCompositeUserType(type);

return CustomType(TypeMapping.GetTypeString(type));
return CustomType(type);
}

private void AddColumnsFromCompositeUserType(Type compositeUserType)
Expand Down Expand Up @@ -361,4 +359,4 @@ TypeReference GetDefaultType()
return type;
}
}
}
}

0 comments on commit c366f6a

Please sign in to comment.