예제 #1
0
 protected override void AddAssociations()
 {
     base.AddAssociations();
     foreach (var entityJoinInfo in translator.GetEntityJoins().Values)
     {
         var tableAlias   = translator.GetSQLAlias(entityJoinInfo.Criteria);
         var criteriaPath = entityJoinInfo.Criteria.Alias;                 //path for entity join is equal to alias
         var persister    = entityJoinInfo.Persister as IOuterJoinLoadable;
         AddExplicitEntityJoinAssociation(persister, tableAlias, translator.GetJoinType(criteriaPath), GetWithClause(criteriaPath));
         IncludeInResultIfNeeded(persister, entityJoinInfo.Criteria, tableAlias);
         //collect mapped associations for entity join
         WalkEntityTree(persister, tableAlias, criteriaPath, 1);
     }
 }
예제 #2
0
 protected override JoinType GetJoinType(IAssociationType type, FetchMode config, string path, string lhsTable,
                                         string[] lhsColumns, bool nullable, int currentDepth,
                                         CascadeStyle cascadeStyle)
 {
     if (translator.IsJoin(path))
     {
         return(translator.GetJoinType(path));
     }
     else
     {
         if (translator.HasProjection)
         {
             return(JoinType.None);
         }
         else
         {
             FetchMode fetchMode = translator.RootCriteria.GetFetchMode(path);
             if (IsDefaultFetchMode(fetchMode))
             {
                 return(base.GetJoinType(type, config, path, lhsTable, lhsColumns, nullable, currentDepth, cascadeStyle));
             }
             else
             {
                 if (fetchMode == FetchMode.Join)
                 {
                     IsDuplicateAssociation(lhsTable, lhsColumns, type);                             //deliberately ignore return value!
                     return(GetJoinType(nullable, currentDepth));
                 }
                 else
                 {
                     return(JoinType.None);
                 }
             }
         }
     }
 }