Can I automate a tree hierarchy using Fluent NHibernate?

Is it possible to automatically display a simple structure of nested objects?

Something like that:

public class Employee : Entity
{
    public Employee() {
         this.Manages = new List<Employee>();
    }
    public virtual string FirstName { get; set; }
    public virtual string LastName { get; set; }
    public virtual bool IsLineManager { get; set; }
    public virtual Employee Manager { get; set; }
    public virtual IList<Employee> Manages { get; set; }
}

At runtime, it raises the following error:

Duplicate column in collection mapping: SharpKtulu.Core.Employee.Manages: EmployeeFk column

Is it possible to automate this structure, or am I redefining the autoframe for this kind of structure?

+3
source share
2 answers

, , , " " + "Fk". , FK "" "". , FK , , EmployeeManagerFk EmployeeManagesFk. , (EmployeeManagerInEmployeeFk) ..

. , . HasMany/ManyToMany . FNH, Google, - .

.hbm . NHibernate , , .hbm - , / "" , , . , .

+2

Source: https://habr.com/ru/post/1736385/


All Articles