diff --git a/src/FluentNHibernate.Testing/ConventionsTests/OverridingFluentInterface/PropertyConventionTests.cs b/src/FluentNHibernate.Testing/ConventionsTests/OverridingFluentInterface/PropertyConventionTests.cs index 3a1ce8a36..651a08b9d 100644 --- a/src/FluentNHibernate.Testing/ConventionsTests/OverridingFluentInterface/PropertyConventionTests.cs +++ b/src/FluentNHibernate.Testing/ConventionsTests/OverridingFluentInterface/PropertyConventionTests.cs @@ -65,7 +65,7 @@ public void TypeShouldntBeOverwritten() Convention(x => x.CustomType()); - VerifyModel(x => x.Type.Name.ShouldEqual(typeof(CustomUserType).AssemblyQualifiedName)); + VerifyModel(x => x.Type.GetUnderlyingSystemType().ShouldEqual(typeof(CustomUserType))); } [Test] @@ -285,4 +285,4 @@ void VerifyModel(Action modelVerification) } #endregion -} +} \ No newline at end of file diff --git a/src/FluentNHibernate.Testing/DomainModel/Mapping/ClassMapConventionsTester.cs b/src/FluentNHibernate.Testing/DomainModel/Mapping/ClassMapConventionsTester.cs index 764f2939e..d0a83efa4 100644 --- a/src/FluentNHibernate.Testing/DomainModel/Mapping/ClassMapConventionsTester.cs +++ b/src/FluentNHibernate.Testing/DomainModel/Mapping/ClassMapConventionsTester.cs @@ -108,6 +108,6 @@ public void EnumsDontGetTypeOverriddenByConventionsIfExplicitlySet() { new MappingTester() .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); } -} +} \ No newline at end of file diff --git a/src/FluentNHibernate/Mapping/PropertyPart.cs b/src/FluentNHibernate/Mapping/PropertyPart.cs index 03245b20f..740c25030 100644 --- a/src/FluentNHibernate/Mapping/PropertyPart.cs +++ b/src/FluentNHibernate/Mapping/PropertyPart.cs @@ -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; @@ -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; } /// @@ -194,11 +195,7 @@ public PropertyPart CustomType(string type) public PropertyPart CustomType(Func 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)