Skip to content
Merged
Show file tree
Hide file tree
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
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 Expand Up @@ -285,4 +285,4 @@ void VerifyModel(Action<PropertyMapping> modelVerification)
}

#endregion
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,6 @@ 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);
}
}
}
13 changes: 5 additions & 8 deletions src/FluentNHibernate/Mapping/PropertyPart.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ public class PropertyPart : IPropertyMappingProvider
{
readonly Member member;
readonly Type parentType;
readonly AttributeStore attributes = new AttributeStore();
readonly AttributeStore columnAttributes = new AttributeStore();
readonly AttributeStore attributes = new();
readonly AttributeStore columnAttributes = new();

bool nextBool = true;

Expand Down Expand Up @@ -171,7 +171,8 @@ 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 @@ -194,11 +195,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);
}

void AddColumnsFromCompositeUserType(Type compositeUserType)
Expand Down