CompiledQuery support with Entity Framework

CompiledQuery support with Entity Framework

Postby jason.morris » Thu 17 Sep 2009 15:34

I'm attempting to create a compiled query in Oracle and am running into problems with the parameters. The error I get is:

The specified parameter type 'System.String' is not valid. Only scalar parameters (such as Int32, Decimal, and Guid) are supported.

According to this, strings and even classes/structs are supported in Entity Framework, so I'm guessing this is a limitation of Devart dotConnect?
http://social.msdn.microsoft.com/forums ... b6e9922cf/

Sample code:
Private _compiledCustomerSearch As Func(Of OPEntities, Integer, String, String, IQueryable(Of CustomerNameAndNumber))

_compiledCustomerSearch = CompiledQuery.Compile(Of OPEntities, Integer, String, String, IQueryable(Of CustomerNameAndNumber)) _
(Function(ctx, customerID, telNum, businessName) _
From c In ctx.EnterpriseCustomers _
Join mainListing In ctx.EnterpriseListings On c.MAIN_LISTING_ID Equals mainListing.LISTING_ID _
Join listing In ctx.EnterpriseListings On c.CUSTOMER_ID Equals listing.CUSTOMER_ID _
Where mainListing.VERSION = 1 _
And listing.VERSION = 1 _
And (c.CUSTOMER_ID = customerID Or customerID = 0) _
And (listing.LISTED_TN = telNum Or telNum Is Nothing) _
And (c.BUSINESS_NAME.ToUpper().StartsWith(businessName.ToUpper()) Or businessName Is Nothing) _
And (mainListing.STATUS <> "D") _
Select New CustomerNameAndNumber With {.CustomerID = c.CUSTOMER_ID, .BusinessName = c.BUSINESS_NAME, .AccountTelNum = mainListing.ACCOUNT_TEL_NUMBER, .Status = mainListing.STATUS} _
Distinct.OrderBy(Function(c) c.BusinessName).Take(500))

Dim query = _compiledCustomerSearch.Invoke(_Context, criteria.CustomerID, criteria.TelNum, criteria.BusinessName)

Is this a known limitation of dotConnect?

Thanks
Jason
jason.morris
 
Posts: 1
Joined: Thu 17 Sep 2009 15:29

Postby AndreyR » Fri 18 Sep 2009 08:51

The error you have described is sent by the CompiledQuery engine, it is not a Devart-specific error.
I recommend you to unwrap the query you want to compile and try to execute it, this should help to find the problem.
You can also send us (support * devart com, subject "EF: CompiledQuery") a small test project reproducing the error.
Please include the script of DB objects you are using.
AndreyR
Devart Team
 
Posts: 2919
Joined: Mon 07 Jul 2008 13:16


Return to dotConnect for Oracle