protected override JoinType GetJoinType(IAssociationType type, FetchMode config, string path, string pathAlias,
                                                string lhsTable, string[] lhsColumns, bool nullable, int currentDepth, CascadeStyle cascadeStyle)
        {
            if (translator.IsJoin(path, pathAlias))
            {
                return(translator.GetJoinType(path, pathAlias));
            }

            if (translator.HasProjection)
            {
                return(JoinType.None);
            }

            var selectMode = translator.RootCriteria.GetSelectMode(path);

            switch (selectMode)
            {
            case SelectMode.Undefined:
                return(base.GetJoinType(type, config, path, pathAlias, lhsTable, lhsColumns, nullable, currentDepth, cascadeStyle));

            case SelectMode.Fetch:
            case SelectMode.FetchLazyProperties:
            case SelectMode.ChildFetch:
            case SelectMode.JoinOnly:
                IsDuplicateAssociation(lhsTable, lhsColumns, type);                         //deliberately ignore return value!
                return(GetJoinType(nullable, currentDepth));

            case SelectMode.Skip:
                return(JoinType.None);

            default:
                throw new ArgumentOutOfRangeException(nameof(selectMode), selectMode.ToString());
            }
        }
Exemple #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);
                 }
             }
         }
     }
 }