Using ObjectManager.Find to Join Entities

Is there any possibility to join entities that do not know each other by associations?

Something like this:

TObjectManager.Find.CreateAlias(TEntity2, 'b').Join(Linq['Id'].Eq('b.field').

No, unfortunately that is not possible, for that you should use a low level SQL expression condition.

That's the expected answer :wink:

Do you have an example, how SQL expression condition could be used to join?

Because in my mind it will not work with TCustomCriterion "Where".

TCustomCriterion "where" got me to this:
TObjectManager.Find.Where(Linq.SQL('JOIN entity2 ent on ent.field = {field}'));

as SQL I think it would look like that because of "where":
Select ...
from entity
join entity2 ent on ent.field = field

but it should look like this:
Select ...
from entity
join entity2 ent on ent.field = field

Indeed, the SQL expression is only for Where. I'm not sure if you just want to filter out records, in this case you can use the WHERE condition, or EXISTS, or something similar.

For something that you need to retrieve data from the other table and it's not included in the SQL, then indeed it's not possible.

Yeah, I have to fetch some columns of the other Entity.

And because there are more than 1 column an subselect within a projection is also not the best idea...

So I could use XDataset an build my own sql-statement and work with the Dataset...
But I would prefer to only fetch datas using Aurelius, not RemoteDB-Tools or anything else...

Why would you need RemoteDB? Either use Aurelius or direct SQL statements. All Aurelius does is to also execute direct SQL statements, in the end.

At the end, you're right. XDataset is the best opportunity, because we got several projects working with IDBConnections.

So I could implement it once for all projects.

@wlandgraf I could implement Associations, if these would be available as DynamicProperties...

Should I create a Feature-Request for this?

No need, associations (and many-valued associations) in dynamic properties are now supported in version 5.13:

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.