我有两个类被映射到数据库中。这些表彼此之间有着主键和外键关系,并使用字段“DeptId”进行关联。
Employee.cs
public class Employee: Entity
{
public virtual Int32 Id { get; set; }
public virtual string Name { get; set; }
public virtual string Gender { get; set; }
public virtual Int32 Age { get; set; }
public virtual string Designation { get; set; }
public virtual bool Enabled { get; set; }
public virtual int CreatedById { get; set; }
public virtual DateTime CreatedDate { get; set; }
public virtual int? LastModifiedById { get; set; }
public virtual DateTime? LastModifiedDate { get; set; }
public virtual bool IsDeleted { get; set; }
public virtual Department Department { get; set; }
}
Department.cs
public class Department
{
public virtual int DeptId { get; set; }
public virtual string DeptName { get; set; }
public virtual bool Enabled { get; set; }
}
我是NHibernate的新手,无法使用QueryOver编写更复杂的Linq查询。我已经编写了以下查询,但如何编写更高级的查询呢?请为我提供示例查询和参考资料。
var query = Session.QueryOver<Employee>().List();