Skip to content

Commit 5e81ece

Browse files
committed
Remove a binary breaking change introduced in #305
1 parent 90e75b9 commit 5e81ece

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

src/NHibernate/Mapping/ByCode/IPlainPropertyContainerMapper.cs

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
using System.Collections.Generic;
44
using System.Linq.Expressions;
55
using System.Reflection;
6+
using NHibernate.Mapping.ByCode.Impl.CustomizersImpl;
7+
using NHibernate.Util;
68

79
namespace NHibernate.Mapping.ByCode
810
{
@@ -41,7 +43,6 @@ public interface IBasePlainPropertyContainerMapper<TContainer> : IMinimalPlainPr
4143
void Component<TComponent>(Expression<Func<TContainer, TComponent>> property, Action<IComponentMapper<TComponent>> mapping);
4244
void Component<TComponent>(Expression<Func<TContainer, TComponent>> property);
4345
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;
4546

4647
void Component<TComponent>(string notVisiblePropertyOrFieldName, Action<IComponentMapper<TComponent>> mapping);
4748
void Component<TComponent>(string notVisiblePropertyOrFieldName);
@@ -56,4 +57,19 @@ public interface IPlainPropertyContainerMapper<TContainer> : IBasePlainPropertyC
5657
void OneToOne<TProperty>(Expression<Func<TContainer, TProperty>> property, Action<IOneToOneMapper<TProperty>> mapping) where TProperty : class;
5758
void OneToOne<TProperty>(string notVisiblePropertyOrFieldName, Action<IOneToOneMapper<TProperty>> mapping) where TProperty : class;
5859
}
59-
}
60+
61+
public static class BasePlainPropertyContainerMapperExtensions
62+
{
63+
//6.0 TODO: Merge into IBasePlainPropertyContainerMapper<> interface
64+
public static void Component<TContainer, TComponent>(
65+
this IBasePlainPropertyContainerMapper<TContainer> mapper,
66+
Expression<Func<TContainer, IDictionary<string, object>>> property,
67+
TComponent dynamicComponentTemplate,
68+
Action<IDynamicComponentMapper<TComponent>> mapping) where TComponent : class
69+
{
70+
var customizer = ReflectHelper.CastOrThrow<PropertyContainerCustomizer<TContainer>>(
71+
mapper, "mapping a generic <string, object> dictionary as a dynamic component");
72+
customizer.Component(property, dynamicComponentTemplate, mapping);
73+
}
74+
}
75+
}

0 commit comments

Comments
 (0)