I have the following example:
ObjectManager.Find<TChildEntity>
.Select(TProjections.Count(csId))
.Where(Linq['ParentEntity'] = SomeId).UniqueValue.
which creates the following SQL:
Select count('id')
from child_entity
where parent_entity_id = 1
This works fine.
But I'd like to use our dictionary for this.
Trying to fetch the Child like this:
ObjectManager.Find<TChildEntity>
.Select(TProjections.Count(csId))
.Where(EntDic.ChildEntity.ParentEntity.Id = SomeId).UniqueValue.
will create the following SQL:
Select count('a.id')
from child_entity a
left join parent_entity b on a.parent_entity_id = b.id
where b.id = 1
How to use the Dictionary, getting the first SQL-Statement?
wlandgraf
(Wagner Landgraf)
2
Actually your first query works "by accident" and is not officially supported by Aurelius. Thus there is no alternative for it using dictionary.
Ok, can you tell me, what would be the supported way do fetch this?
wlandgraf
(Wagner Landgraf)
4
You can use an SQL expression to query directly by the database column name, as described here:
For example:
ObjectManager.Find<TChildEntity>
.Select(TProjections.Count(csId))
.Where(Linq.Sql<Integer>('A.parent_id = ?'), someValue)