Проекция Nhibernate на вложенные вложенные свойства

У меня есть местоположение класса домена

    public abstract class BaseEntity<T> where T: struct 
    {
    public virtual T Id { get; set; }
    public virtual bool Equals(BaseEntity<T> other)
    }

    public class Location : BaseEntity<Int32>
    {

    public  User User {get;set;}
    }

    public class User : BaseEntity<Int32>
    {
    public string Name {get;set;
    }

    public OtherInfo Otherinfo {get;set;};
     }
    public class OtherInfo
    {
    public  string preference {get;set;};
    }

    var criteria = session.CreateCriteria(typeof(Location), "alias");
    criteria.CreateCriteria("User", "user", JoinType.InnerJoin);
    criteria.CreateCriteria("user.Otherinfo", "userInfo",JoinType.InnerJoin); 
    criteria.Add(Restrictions.Eq("user.Id", 100));
    criteria.SetProjection(Projections.Alias(Projections.Id(), "Id"),                            Projections.Alias(Projections.Property("user.Name"), "Name"),  Projections.Alias(Projections.Property("userInfo.preference "), "pref"));

теперь, когда я выполняю вышеуказанные критерии, выдается ошибка в userInfo.preference. {NHibernate.QueryException: не удалось разрешить свойство: Otherinfo: Location.User В чем тут ошибка. это из-за нескольких вложенных объектов

6
задан Techmaster 24 May 2012 в 14:51
поделиться