Hello,
I use the latest stable version of dotConnect for Oracle. When i run the following query, i get an exception.
(from objCustomer in dataContext.Customers
where
(dataContext.Query(
"SELECT cu_id FROM vw_root_cu_code where root_par_code = '10385888'").Select(
a => a)).Contains(objCustomer.Id)
select objCustomer).ToList()
ArgumentNullException
Value cannot be null.
Parameter name: key
What i'm trying to do is to generate this simple SQL:
SELECT A.* FROM CUSTOMERS A WHERE EXISTS (SELECT VW.CU_ID FROM VW_ROOT_CODE VW WHERE VW.ROOT_PAR_CODE = '10385888' AND VW.CU_ID = A.CU_ID)
ATTENTION! I don't have the option to generate an Entity for the view, because it is created dynamically through configuration by the application user, therefore the use of the Query method is mandatory and i cannot project to a specific Entity.
I really don't understand the need for that when generating an EXISTS clause. There is not a requirement to know the structure of the inner table. It can be anything, as long as i provide a Name with an alias plus the key column name prefixed with the alias...
Context.Query used in generation of EXISTS clause
There is a workaround in this case. Use the following code:
This code will work in the next build.
Code: Select all
(from objCustomer in dataContext.Customers
where
(dataContext.Query(
"SELECT cu_id as \"c1\" FROM vw_root_cu_code where root_par_code = '10385888'").Select(
a => a)).Contains(objCustomer.Id)
select objCustomer).ToList()