From: <fab...@us...> - 2011-04-08 17:57:11
|
Revision: 5646 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5646&view=rev Author: fabiomaulo Date: 2011-04-08 17:57:05 +0000 (Fri, 08 Apr 2011) Log Message: ----------- Multi type registration auto filter valid conformist mappings classes Modified Paths: -------------- trunk/nhibernate/src/NHibernate/Mapping/ByCode/ModelMapper.cs trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExpliticMappingTests/ConformistMappingRegistrationTests/ClassMappingRegistrationTest.cs Modified: trunk/nhibernate/src/NHibernate/Mapping/ByCode/ModelMapper.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Mapping/ByCode/ModelMapper.cs 2011-04-08 17:52:52 UTC (rev 5645) +++ trunk/nhibernate/src/NHibernate/Mapping/ByCode/ModelMapper.cs 2011-04-08 17:57:05 UTC (rev 5646) @@ -1645,7 +1645,7 @@ { throw new ArgumentNullException("types"); } - foreach (var type in types) + foreach (var type in types.Where(x=> typeof(IConformistHoldersProvider).IsAssignableFrom(x))) { AddMapping(type); } Modified: trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExpliticMappingTests/ConformistMappingRegistrationTests/ClassMappingRegistrationTest.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExpliticMappingTests/ConformistMappingRegistrationTests/ClassMappingRegistrationTest.cs 2011-04-08 17:52:52 UTC (rev 5645) +++ trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExpliticMappingTests/ConformistMappingRegistrationTests/ClassMappingRegistrationTest.cs 2011-04-08 17:57:05 UTC (rev 5646) @@ -59,6 +59,16 @@ } [Test] + public void WhenRegisterClassMappingThroughCollectionOfTypeThenFilterValidMappings() + { + var mapper = new ModelMapper(); + mapper.Executing(x=> x.AddMappings(new[] { typeof(object), typeof(MyClassMap), typeof(MyClass) })).NotThrows(); + var hbmMapping = mapper.CompileMappingFor(new[] { typeof(MyClass) }); + + ModelIsWellFormed(hbmMapping); + } + + [Test] public void WhenRegisterClassMappingThroughTypeThenGetMapping() { var mapper = new ModelMapper(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |