entity framework 4 - Differences in generated SQL - Local to Production Server -


our sql dba has pointed out ef generating sql causing implicit conversion , leading performance problems. when run web application locally, see different query stage/production servers generating. assuming there ef differences between dev box , server , need determining look. have verified queries in sql profiler.

local: windows 7, 64-bit, iis 7

servers: windows server 2003, 32-bit, iis 6

linq statement (incoming list of type string):

var result = in context.productimages                          incoming.contains(i.productid)                          select i;             var sql = ((system.data.objects.objectquery)result).totracestring();              return result.tolist(); 

local generated query:

select [extent1].[column1], [extent1].[column2], ..rest of columns... [extent1].[productid] in ('000176725','000176726','000176728') 

server generated query:

select [extent1].[column1], [extent1].[column2], ..rest of columns... [extent1].[productid] in (n'000176725',n'000176726',n'000176728') 

any ideas on investigate determine causing generation difference? "n'" causing performance challenge.

as far can tell, system.data.entity dll same version (4.0.30319.1)

looks server runs actual .net framework 4 while on box have .net framework 4.5. (note version of system.data.entity.dll same). there bug in ef fixed in ef5/.net framework 4.5 , since .net framework 4.5 in-place update fix automatically picked apps using ef4 on boxes have .net framework 4.5 installed.

you can change app work around bug described here.


Comments