pat wrote:
Otis wrote:
This means you can set the predicate to be a field compare expression predicate which compares a field to a dbfunction call.
...
Another way, if you're able to use Linq (so you're on .NET 3.5), is to map a .net method onto the db function you want to call (see documentation how to do that) and then use it like:
Hm both examples above and the documentation give only examples for scalar values while the SQL UDF would return a table.
My bad, I should have anticipated on that.
Is there any chance you could show me with some code how to make this query work with .NET 3.5, LLBLGen Pro 2.6?
pat wrote:
I would like to retrieve an entity collection of hierarchical entities.
To filter them I would like to use an inner join to a UDF (User Defined Function which uses a CTE (common table expression))
e.g.
SELECT e.Id, e.ParentId, e.Name FROM Tree AS E
INNER JOIN dbo.TreeCTE('25') AS C on E.Id = C.Id
This would allow me to use an recursive CTE inside the UDF and still work with the normal LLBLGen entities.
Thanks a lot!
Patrick
There are two things:
1) make the query compile
2) make sure the right sql is generated.
The first one is a big bottleneck, as the method stub which is used in the Linq query (and which is used to obtain the db function etc.) has to return an object with fields which is then usable in the 'on clause' of the join statement in the linq query. Without that, the query won't compile.
I'll do some tests to see if I can get this working.