@@ -65,6 +65,10 @@ internal static Exception GetDirectUsageException()
65
65
[ Serializable ]
66
66
public abstract partial class QueryOver < TRoot > : QueryOver , IQueryOver < TRoot >
67
67
{
68
+ protected internal QueryOver < TRoot , U > Create < U > ( ICriteria criteria )
69
+ {
70
+ return new QueryOver < TRoot , U > ( impl , criteria ) ;
71
+ }
68
72
69
73
private IList < TRoot > List ( )
70
74
{
@@ -280,7 +284,8 @@ IQueryOver<TRoot> IQueryOver<TRoot>.ReadOnly()
280
284
/// Implementation of the <see cref="IQueryOver<TRoot, TSubType>"/> interface
281
285
/// </summary>
282
286
[ Serializable ]
283
- public class QueryOver < TRoot , TSubType > : QueryOver < TRoot > , IQueryOver < TRoot , TSubType >
287
+ public class QueryOver < TRoot , TSubType > : QueryOver < TRoot > , IQueryOver < TRoot , TSubType > ,
288
+ ISupportEntityJoinQueryOver < TRoot >
284
289
{
285
290
286
291
protected internal QueryOver ( )
@@ -658,6 +663,11 @@ public QueryOver<TRoot,U> JoinQueryOver<U>(Expression<Func<IEnumerable<U>>> path
658
663
joinType ) ) ;
659
664
}
660
665
666
+ public QueryOver < TRoot , U > JoinEntityQueryOver < U > ( Expression < Func < U > > alias , JoinType joinType , ICriterion withClause , string entityName )
667
+ {
668
+ return Create < U > ( CreateEntityCriteria ( alias , joinType , withClause , entityName ) ) ;
669
+ }
670
+
661
671
public QueryOver < TRoot , TSubType > JoinAlias ( Expression < Func < TSubType , object > > path , Expression < Func < object > > alias )
662
672
{
663
673
return AddAlias (
@@ -758,6 +768,11 @@ private QueryOver<TRoot,TSubType> AddAlias(string path, string alias, JoinType j
758
768
return this ;
759
769
}
760
770
771
+ private ICriteria CreateEntityCriteria < U > ( Expression < Func < U > > alias , JoinType joinType , ICriterion withClause , string entityName )
772
+ {
773
+ return criteria . CreateEntityCriteria ( ExpressionProcessor . FindMemberExpression ( alias . Body ) , joinType , withClause , entityName ?? typeof ( U ) . FullName ) ;
774
+ }
775
+
761
776
private QueryOver < TRoot , TSubType > Add ( Expression < Func < TSubType , bool > > expression )
762
777
{
763
778
criteria . Add ( ExpressionProcessor . ProcessExpression < TSubType > ( expression ) ) ;
@@ -974,6 +989,17 @@ IQueryOver<TRoot,TSubType> IQueryOver<TRoot,TSubType>.JoinAlias<U>(Expression<Fu
974
989
IQueryOver < TRoot , TSubType > IQueryOver < TRoot , TSubType > . JoinAlias < U > ( Expression < Func < IEnumerable < U > > > path , Expression < Func < U > > alias , JoinType joinType , ICriterion withClause )
975
990
{ return JoinAlias ( path , alias , joinType , withClause ) ; }
976
991
992
+ IQueryOver < TRoot , U > ISupportEntityJoinQueryOver < TRoot > . JoinEntityQueryOver < U > ( Expression < Func < U > > alias , JoinType joinType , ICriterion withClause , string entityName )
993
+ {
994
+ return JoinEntityQueryOver ( alias , joinType , withClause , entityName ) ;
995
+ }
996
+
997
+ //6.0 TODO: to remove and merge with extension EntityJoinExtensions.JoinEntityAlias
998
+ void ISupportEntityJoinQueryOver . JoinEntityAlias < U > ( Expression < Func < U > > alias , JoinType joinType , ICriterion withClause , string entityName )
999
+ {
1000
+ CreateEntityCriteria ( alias , joinType , withClause , entityName ) ;
1001
+ }
1002
+
977
1003
IQueryOverJoinBuilder < TRoot , TSubType > IQueryOver < TRoot , TSubType > . Inner
978
1004
{ get { return new IQueryOverJoinBuilder < TRoot , TSubType > ( this , JoinType . InnerJoin ) ; } }
979
1005
0 commit comments