示例#1
0
        public void CanCreateSubqueryFromDetachedCriteria()
        {
            DetachedCriteria criteria = DetachedCriteria.For <UserEntity>()
                                        .Add(Restrictions.Eq("Id", (long)2))
                                        .SetProjection(Projections.Property("Id"));

            FlowQuerySelection <UserEntity> users = Query <UserEntity>()
                                                    .Where(x => x.Id, FqIs.In(criteria.DetachedFlowQuery()))
                                                    .Select();

            Assert.That(users.Count(), Is.EqualTo(1));
            Assert.That(users.First().Id, Is.EqualTo(2));
        }
示例#2
0
 /// <summary>
 ///     Creates a "is in" filter.
 /// </summary>
 /// <param name="query">
 ///     The subquery yielding the results to match.
 /// </param>
 /// <returns>
 ///     The <see cref="IsExpression"/> filter.
 /// </returns>
 public static IsExpression In(DetachedCriteria query)
 {
     return(In(query.DetachedFlowQuery()));
 }