CompiledQuery support with Entity Framework
Posted: 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
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