1

select N+1 issue次のクエリで直面しています。私は初めてですNHibernate。でこのクエリを解決するのを手伝ってくれる人はいますかNHibernate using Eager loading?

public IList<MasterForecastInputSourceMatch> GetMasterForecastInputSourceMatchInfo(Guid elementId)
{
        var selectQuery = _session.CreateQuery("from MasterForecastInputSourceMatch where ElementInputInfo.Id = :id")
            .SetParameter("id", elementId);
        return selectQuery.List<MasterForecastInputSourceMatch>();
}

これが生成されたクエリです。NHibernate Profiler を使用しました

select masterfore0_.Id                    as Id88_,
   masterfore0_.UpdateDate            as UpdateDate88_,
   masterfore0_.MasterForecastInfo_id as MasterFo3_88_,
   masterfore0_.ElementInputInfo_id   as ElementI4_88_
   from   [PATH_MasterForecastInputSourceMatch] masterfore0_
   where  masterfore0_.ElementInputInfo_id = 'c414e888-cb9b-4c11-a52d-9fcd00a05ba4'
4

0 に答える 0