File tree Expand file tree Collapse file tree 2 files changed +26
-1
lines changed
FluentNHibernate.Testing/DomainModel/Mapping Expand file tree Collapse file tree 2 files changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -441,6 +441,18 @@ public void CanSpecifyNotUpdate()
441
441
. Element ( "class/property" ) . HasAttribute ( "update" , "false" ) ;
442
442
}
443
443
444
+ [ Test ]
445
+ public void MapNestedGeneric ( )
446
+ {
447
+ new MappingTester < OuterTarget < String > . NestedTarget > ( )
448
+ . ForMapping ( m =>
449
+ {
450
+ m . Id ( x => x . Id ) ;
451
+ m . Map ( x => x . Value ) ;
452
+ } )
453
+ . Element ( "class" ) . HasAttribute ( "table" , "`NestedTarget_String`" ) ;
454
+ }
455
+
444
456
#region Custom IUserType impl for testing
445
457
public class CustomTypeForTesting : IUserType
446
458
{
@@ -609,6 +621,15 @@ public class ComponentTarget
609
621
public object Name { get ; set ; }
610
622
}
611
623
624
+ class OuterTarget < T >
625
+ {
626
+ public class NestedTarget
627
+ {
628
+ public virtual int Id { get ; set ; }
629
+ public virtual T Value { get ; set ; }
630
+ }
631
+ }
632
+
612
633
public class FakePropertyAccessor : IPropertyAccessor
613
634
{
614
635
public IGetter GetGetter ( Type theClass , string propertyName )
Original file line number Diff line number Diff line change @@ -691,7 +691,11 @@ string GetDefaultTableName()
691
691
if ( EntityType . IsGenericType )
692
692
{
693
693
// special case for generics: GenericType_GenericParameterType
694
- tableName = EntityType . Name . Substring ( 0 , EntityType . Name . IndexOf ( '`' ) ) ;
694
+ var genericQuoteIndex = EntityType . Name . IndexOf ( '`' ) ;
695
+ if ( genericQuoteIndex >= 0 )
696
+ {
697
+ tableName = EntityType . Name . Substring ( 0 , genericQuoteIndex ) ;
698
+ } // else generic declaration not directly in this class
695
699
696
700
foreach ( var argument in EntityType . GetGenericArguments ( ) )
697
701
{
You can’t perform that action at this time.
0 commit comments