Skip to content

Document "entity join" and "entity projection" #1619

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 19, 2018

Conversation

bahusoid
Copy link
Member

As requested by @fredericDelaporte in #1545 (comment) and #1471 (comment)

I feel pretty lousy at writing clear docs :) So @fredericDelaporte feel free to modify it in whatever way you think fit.

Copy link
Member

@fredericDelaporte fredericDelaporte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sounds good to me, I just have some minor suggestions.

@@ -141,12 +141,35 @@ var cats = sess.CreateCriteria<Cat>()
.List<IDictionary>();
foreach ( IDictionary map in cats )
{
Cat cat = (Cat) map[CriteriaUtil.RootAlias];
Cat cat = (Cat) map[CriteriaSpecification.RootAlias];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So NH-2122 has missed this one, good spot.

</para>

<programlisting><![CDATA[IList<Cat> uniquelyNamedCats = sess.CreateCriteria<Cat>("c")
.CreateEntityAlias(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The auto-indent of IDE does not play very well with programlisting. I usually take care of reducing default first indentation to the usual 4 spaces, to avoid code expanding a bit to fast to the left. (But in the case of this example and the others you have added, lines stay short so it should not be an issue, excepted being a small visual discrepancy with other code examples.)

<title>Join not associated entities (Entity joins or ad hoc joins)</title>
<para>
In criteria you have the ability to define a join to any entity, not just a mapped association.
To achieve it use <literal>CreateEntityAlias</literal> and <literal>CreateEntityCriteria</literal>. For example:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems "for example" is used for enumerating possibilities while "by example" is used for providing one example. So maybe "By example" would be more appropriate here. (Same in QueryOver.)


<para>
Or via <literal>Projections.RootEntity</literal> and <literal>Projections.Entity</literal> methods
if more control over loaded entities required. For instance entity projections can be lazy loaded
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Partial sentence should be avoided. Or it can be done via would be better than just Or via.

if more control over loaded entities required lacks an auxiliary, it should be: if more control over loaded entities is required.



<sect1 id="querycriteria_entityjoin">
<title>Join not associated entities (Entity joins or ad hoc joins)</title>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Join entities without association would sound better to me. (Same for QueryOver.)

@@ -350,6 +369,32 @@ IList<CatSummary> catReport =

</sect1>

<sect1 id="queryqueryover-projectionentities">
<title>Projection Entities</title>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think words should be inverted: Entities Projection. (The previous section title about functions has the same issue.)

@bahusoid
Copy link
Member Author

Forced push suggested changes.

Copy link
Member

@fredericDelaporte fredericDelaporte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have added some additional minor adjustments. And I have launched the TeamCity release build, since this is the only build which build doc.

@fredericDelaporte fredericDelaporte self-assigned this Mar 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants