@@ -43,13 +43,15 @@ public void Id<TProperty>(Expression<Func<TEntity, TProperty>> idProperty, Actio
43
43
CustomizersHolder . AddCustomizer ( typeof ( TEntity ) , m => m . Id ( member , idMapper ) ) ;
44
44
}
45
45
46
- public void Id ( FieldInfo idProperty , Action < IIdMapper > idMapper )
46
+ public void Id ( string notVidiblePropertyOrFieldName , Action < IIdMapper > idMapper )
47
47
{
48
- if ( idProperty != null )
48
+ MemberInfo member = null ;
49
+ if ( notVidiblePropertyOrFieldName != null )
49
50
{
50
- ExplicitDeclarationsHolder . AddAsPoid ( idProperty ) ;
51
+ member = typeof ( TEntity ) . GetPropertyOrFieldMatchingName ( notVidiblePropertyOrFieldName ) ;
52
+ ExplicitDeclarationsHolder . AddAsPoid ( member ) ;
51
53
}
52
- CustomizersHolder . AddCustomizer ( typeof ( TEntity ) , m => m . Id ( idProperty , idMapper ) ) ;
54
+ CustomizersHolder . AddCustomizer ( typeof ( TEntity ) , m => m . Id ( member , idMapper ) ) ;
53
55
}
54
56
55
57
public void ComponentAsId < TComponent > ( Expression < Func < TEntity , TComponent > > idProperty ) where TComponent : class
@@ -64,6 +66,18 @@ public void ComponentAsId<TComponent>(Expression<Func<TEntity, TComponent>> idPr
64
66
idMapper ( new ComponentAsIdCustomizer < TComponent > ( ExplicitDeclarationsHolder , CustomizersHolder , propertyPath ) ) ;
65
67
}
66
68
69
+ public void ComponentAsId < TComponent > ( string notVidiblePropertyOrFieldName ) where TComponent : class
70
+ {
71
+ ComponentAsId < TComponent > ( notVidiblePropertyOrFieldName , x => { } ) ;
72
+ }
73
+
74
+ public void ComponentAsId < TComponent > ( string notVidiblePropertyOrFieldName , Action < IComponentAsIdMapper < TComponent > > idMapper ) where TComponent : class
75
+ {
76
+ var member = typeof ( TEntity ) . GetPropertyOrFieldMatchingName ( notVidiblePropertyOrFieldName ) ;
77
+ var propertyPath = new PropertyPath ( null , member ) ;
78
+ idMapper ( new ComponentAsIdCustomizer < TComponent > ( ExplicitDeclarationsHolder , CustomizersHolder , propertyPath ) ) ;
79
+ }
80
+
67
81
public void ComposedId ( Action < IComposedIdMapper < TEntity > > idPropertiesMapping )
68
82
{
69
83
idPropertiesMapping ( new ComposedIdCustomizer < TEntity > ( ExplicitDeclarationsHolder , CustomizersHolder ) ) ;
@@ -110,6 +124,13 @@ public void Version<TProperty>(Expression<Func<TEntity, TProperty>> versionPrope
110
124
CustomizersHolder . AddCustomizer ( typeof ( TEntity ) , ( IClassMapper m ) => m . Version ( member , versionMapping ) ) ;
111
125
}
112
126
127
+ public void Version ( string notVidiblePropertyOrFieldName , Action < IVersionMapper > versionMapping )
128
+ {
129
+ var member = typeof ( TEntity ) . GetPropertyOrFieldMatchingName ( notVidiblePropertyOrFieldName ) ;
130
+ ExplicitDeclarationsHolder . AddAsVersionProperty ( member ) ;
131
+ CustomizersHolder . AddCustomizer ( typeof ( TEntity ) , ( IClassMapper m ) => m . Version ( member , versionMapping ) ) ;
132
+ }
133
+
113
134
public void NaturalId ( Action < IBasePlainPropertyContainerMapper < TEntity > > naturalIdPropertiesMapping , Action < INaturalIdAttributesMapper > naturalIdMapping )
114
135
{
115
136
naturalIdPropertiesMapping ( new NaturalIdCustomizer < TEntity > ( ExplicitDeclarationsHolder , CustomizersHolder ) ) ;
0 commit comments