User475983607 posted
hi all
there are 2 ways to get result from query as int or as string like below
as string
int ToplamRecordSayisi = _VNTSClientContext.Set<Gonderiler>().Where(e => e.EnstituId == EnstituId && e.GonderiDurumuId.ToString()=="mystring").Count();
as int
int ToplamRecordSayisi = _VNTSClientContext.Set<Gonderiler>().Where(e => e.EnstituId == EnstituId && e.GonderiDurumuId==myint).Count();
if I use .ToString() does this conversion slows the query?
The int is quicker because the SQL does not have to invoke the convert function.
SELECT [e].[BlogId], [e].[Url]
FROM [Blogs] AS [e]
WHERE [e].[BlogId] = 1
SELECT [e].[BlogId], [e].[Url]
FROM [Blogs] AS [e]
WHERE CONVERT(VARCHAR(11), [e].[BlogId]) = N'1'
You can see and test this yourself using SQL Server Profiler.