Вопрос

I have the following database tables:

  1. Project table
  2. Dependency table with columns (Id, ProjectId, DependentProjectId)

on my Project domain object i have the following mapping to be able to take a project and read its dependencies

  public virtual IList<Dependency> Dependencies { get; set; }

   HasMany(x => x.Dependencies).AsBag().Inverse().Cascade.AllDeleteOrphan().Fetch.Select().BatchSize(80);

I now want to create another property on the Project object to read all of the items where it is the dependent project (to find out the list of projects that has "me" as a dependency.

what is the correct way to do that mapping in fluent nhibernate?

Это было полезно?

Решение

I'd say you would just have to specify the .KeyColumn for the one to many relation, e.g.

  HasMany(x => x.Dependencies)....KeyColumn("ProjectId")

  HasMany(x => x.DependentProjects)....KeyColumn("DependentProjectId")
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top