public void TestGetCriteriaByPath()
        {
            Person           fatherAlias = null;
            DetachedCriteria criteria    =
                DetachedCriteria.For <Person>()
                .CreateCriteria <Person>(p => p.Father, () => fatherAlias);

            Assert.AreEqual("fatherAlias", criteria.GetCriteriaByPath <Person>(p => p.Father).Alias);
        }
        public void TestGetCriteriaByPathUsingAlias()
        {
            Person           personAlias = null;
            Person           fatherAlias = null;
            DetachedCriteria criteria    =
                DetachedCriteria <Person> .Create(() => personAlias)
                .CreateCriteria(() => personAlias.Father, () => fatherAlias);

            Assert.AreEqual("fatherAlias", criteria.GetCriteriaByPath(() => personAlias.Father).Alias);
        }
 public ICriteria GetCriteriaByPath(string path)
 {
     return(detachedCriteria.GetCriteriaByPath(path).Adapt(session));
 }
Пример #4
0
 /// <summary>
 /// Get Detached Criteria for Association Path
 /// </summary>
 /// <param name="dc">detached criteria</param>
 /// <param name="path"></param>
 /// <returns></returns>
 public static DetachedCriteria Path(this DetachedCriteria dc, string path)
 {
     return(dc.GetCriteriaByPath(path) ?? dc.CreateCriteria(path));
 }