From c366f6a8dca95192df750694c90787afcc68e5c7 Mon Sep 17 00:00:00 2001 From: "victor.govorov" Date: Fri, 17 Nov 2017 02:37:26 +0500 Subject: [PATCH] #347 --- .../PropertyConventionTests.cs | 2 +- .../DomainModel/Mapping/ClassMapConventionsTester.cs | 2 +- src/FluentNHibernate/Mapping/PropertyPart.cs | 12 +++++------- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/FluentNHibernate.Testing/ConventionsTests/OverridingFluentInterface/PropertyConventionTests.cs b/src/FluentNHibernate.Testing/ConventionsTests/OverridingFluentInterface/PropertyConventionTests.cs index ed9db8238..54f9a5c6e 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] diff --git a/src/FluentNHibernate.Testing/DomainModel/Mapping/ClassMapConventionsTester.cs b/src/FluentNHibernate.Testing/DomainModel/Mapping/ClassMapConventionsTester.cs index be0017494..1a312dc14 100644 --- a/src/FluentNHibernate.Testing/DomainModel/Mapping/ClassMapConventionsTester.cs +++ b/src/FluentNHibernate.Testing/DomainModel/Mapping/ClassMapConventionsTester.cs @@ -108,7 +108,7 @@ 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 38b15779b..6c3768811 100644 --- a/src/FluentNHibernate/Mapping/PropertyPart.cs +++ b/src/FluentNHibernate/Mapping/PropertyPart.cs @@ -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; } /// @@ -206,11 +208,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); } private void AddColumnsFromCompositeUserType(Type compositeUserType) @@ -361,4 +359,4 @@ TypeReference GetDefaultType() return type; } } -} +} \ No newline at end of file