Skip to content

Commit 4ada99d

Browse files
committed
Remove a binary breaking change introduced in nhibernate#305
1 parent dc71c7d commit 4ada99d

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

src/NHibernate/Mapping/ByCode/IPlainPropertyContainerMapper.cs

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using System.Collections.Generic;
44
using System.Linq.Expressions;
55
using System.Reflection;
6+
using NHibernate.Mapping.ByCode.Impl.CustomizersImpl;
67

78
namespace 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

Comments
 (0)