2013-02-07 3 views
-1

경우 표현 :int를 문자열 열로 변환하는 방법은 무엇입니까?

filtrationResult = filtrationResult.Where(string.Format("Convert.ToString({0}).Contains(@0)", filter.Field), filter.Value); 

filter.Field 내가 오류 얻을 이름 열 (INT32)

입니다 :

LINQ to Entities does not recognize the method 'System.String ToString(Int32)' method, and this method cannot be translated into a store expression. 

어떻게 올바르게 변환?

+0

숫자를 부분 검색하는 것과 비슷합니까? –

+0

Raphaël Althaus, Yes – Mediator

답변

0

filter.Field에 대해 가능한 모든 값을 가진 switch 문을 만든 다음 EF 생성 속성을 사용합니다.

+0

EF를 사용하는 경우'SqlFunctions.StringConvert'를 사용합니다. –

+0

'CompanyListItem'유형에 'SqlFunctions'필드가 없거나 속성이 없습니다. – Mediator

+0

'SqlFunctions'은'static' 클래스입니다. –

관련 문제