본문 바로가기

DB/Entity Framework

(12)
DbArithmeticExpression arguments must have a numeric common type 유발 소스 var attachFileList = context.AttachFile.Where(x => x.CHECK_DATE.Equals(null) || ( !x.CHECK_DATE.Equals(null) && ((TimeSpan)(DateTime.Now – (DateTime)x.CHECK_DATE)).TotalDays > 30 )).ToList(); -> DbArithmeticExpression arguments must have a numeric common type where 조건절에서 datetime 과 datetime 간의 diff 을 수행하려는 구문에 발생합니다. Mssql sp 에서는 문제없이 수행되는 구문이지만 EntityFramework 에서는 조건절의 Datetime 직접 비교는 지원하..
Managed Debugging Assistant 'ContextSwitchDeadlock' has detected a problem in 'D:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO 12.0\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\TESTWINDOW\vstest.executionengine.x86.exe'. Additional information: CLR에서 60초 동안 COM 컨텍스트 0xd84940에서 COM 컨텍스트 0xd849f8(으)로 전환하지 못했습니다. 대상 컨텍스트/아파트를 소유하는 스레드가 펌프 대기를 수행하지 않거나, Windows 메시지를 펌프하지 않고 매우 긴 실행 작업을 처리하고 있는 것 같습니다. 이러한 상황은 대개 성능에 부정적인 영향을 주며 응용 프로그램이 응답하지 않거나 시간이 흐름에 따라 메모리 사용이 증가하는 문제로 이어질 수도 있습니다. 이 문제를 방지하려면 모든 STA(Single Threaded Apartment) 스레드가 펌프 대기 기본 형식(예: CoWaitForMultipleHandles)을 사용하고 긴 실행 작업 동안 지속적으로 메시지를 펌프해야 합니다. 디버..
System.Data.SqlClient.SqlException: An attempt to attach an auto-named database for file [LocalDB파일 경로] failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share. LocalDB 파일로 개발하는 도중 만날 수 있는 예외 메시지입니다. 제가 만난 경우는 메인프로젝트의 App_Data 폴더에 xxxx.mdf local DB가 있고 유닛테스트 프로젝트에서는 참조해서 쓰는 경우에 발생했습니다. 메인 프로젝트의 Web.config 의 Connection String 섹션명과 유닛테스트 프로젝트의 App.config 의 Connection String 섹션 명이 같게 설정되어 있습니다. 관련 내용 검색은 1. localDB data source http://stackoverflow.com/questions/21563940/how-to-connect-to-localdb-in-visual-studio-server-explorer 2. UNC share 관련 http://forum..
EF6 sp 반환셋을 group by 할때 var result = (from r in (connect.Edumate.sMessageReceive(data.startDate, data.endDate, studentList, "", "") .Select(x => new ListItem { Content = x.Content, RegistDate = x.RegistDate })) group r by r.Content into g select new { Content = g.Key, RegistDate = g.Select(x => x.RegistDate).Distinct().FirstOrDefault() } );