33using System . Collections . Generic ;
44using System . Linq . Expressions ;
55using System . Reflection ;
6+ using NHibernate . Mapping . ByCode . Impl . CustomizersImpl ;
67
78namespace NHibernate . Mapping . ByCode
89{
@@ -41,7 +42,6 @@ public interface IBasePlainPropertyContainerMapper<TContainer> : IMinimalPlainPr
4142 void Component < TComponent > ( Expression < Func < TContainer , TComponent > > property , Action < IComponentMapper < TComponent > > mapping ) ;
4243 void Component < TComponent > ( Expression < Func < TContainer , TComponent > > property ) ;
4344 void Component < TComponent > ( Expression < Func < TContainer , IDictionary > > property , TComponent dynamicComponentTemplate , Action < IDynamicComponentMapper < TComponent > > mapping ) ;
44- void Component < TComponent > ( Expression < Func < TContainer , IDictionary < string , object > > > property , TComponent dynamicComponentTemplate , Action < IDynamicComponentMapper < TComponent > > mapping ) where TComponent : class ;
4545
4646 void Component < TComponent > ( string notVisiblePropertyOrFieldName , Action < IComponentMapper < TComponent > > mapping ) ;
4747 void Component < TComponent > ( string notVisiblePropertyOrFieldName ) ;
@@ -56,4 +56,23 @@ public interface IPlainPropertyContainerMapper<TContainer> : IBasePlainPropertyC
5656 void OneToOne < TProperty > ( Expression < Func < TContainer , TProperty > > property , Action < IOneToOneMapper < TProperty > > mapping ) where TProperty : class ;
5757 void OneToOne < TProperty > ( string notVisiblePropertyOrFieldName , Action < IOneToOneMapper < TProperty > > mapping ) where TProperty : class ;
5858 }
59+
60+ public static class BasePlainPropertyContainerMapperExtensions
61+ {
62+ //6.0 TODO: Merge into IBasePlainPropertyContainerMapper<> interface
63+ public static void Component < TContainer , TComponent > (
64+ this IBasePlainPropertyContainerMapper < TContainer > mapper ,
65+ Expression < Func < TContainer , IDictionary < string , object > > > property ,
66+ TComponent dynamicComponentTemplate ,
67+ Action < IDynamicComponentMapper < TComponent > > mapping ) where TComponent : class
68+ {
69+ if ( ! ( mapper is PropertyContainerCustomizer < TContainer > customizer ) )
70+ {
71+ throw new NotSupportedException (
72+ "IBasePlainPropertyContainerMapper<TContainer> should be a PropertyContainerCustomizer<TContainer>" ) ;
73+ }
74+
75+ customizer . Component ( property , dynamicComponentTemplate , mapping ) ;
76+ }
77+ }
5978}
0 commit comments