Esempio n. 1
0
 public override string GetTableName(IAssociationType type)
 {
     if (type.UseLHSPrimaryKey)
     {
         return(Persister.TableName);
     }
     else
     {
         string propertyName = type.LHSPropertyName;
         if (propertyName == null)
         {
             //if there is no property-ref, assume the join
             //is to the subclass table (ie. the table of the
             //subclass that the association belongs to)
             return(Persister.GetSubclassPropertyTableName(propertyIdx));
         }
         else
         {
             //handle a property-ref
             string propertyRefTable = Persister.GetPropertyTableName(propertyName);
             if (propertyRefTable == null)
             {
                 //it is possible that the tree-walking in OuterJoinLoader can get to
                 //an association defined by a subclass, in which case the property-ref
                 //might refer to a property defined on a subclass of the current class
                 //in this case, the table name is not known - this temporary solution
                 //assumes that the property-ref refers to a property of the subclass
                 //table that the association belongs to (a reasonable guess)
                 //TODO: fix this, add: IOuterJoinLoadable.getSubclassPropertyTableName(string propertyName)
                 propertyRefTable = Persister.GetSubclassPropertyTableName(propertyIdx);
             }
             return(propertyRefTable);
         }
     }
 }