What is the best way to succeed at NHibernate?

I am using NHibernate and started using the NHibernate profiler and realized that I have a lot of SQL queries needed. One of the main optimizations for me is the desire to join the front in order to avoid problems with the choice of N + 1.

I am trying to figure out how best to make welcome connections using NHibernate:

IList projects = session.CreateQuery(
      "from Project p left join fetch p.Sponsors left join fetch p.Desks")
      .List();

But this continues to appear with an error:

QueryException: Failed to resolve Property in Domain.Project Sponsors

What is the best way to make reliable connections using NHibernate?

+3
source share
2 answers
+2

, Project .

() :

 [BelongsTo(Column = "Sponsor_ID")]
    public Sponsor sponsors { get; set; }

.

, http://nmg.codeplex.com/ .

, , . ( , ) http://www.agilityfororms.com/Home/Products/AfoCastleActiveRecordModelCodeGenerator/

, , .

Nhibernate : http://www.summerofnhibernate.com/

+2

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


All Articles