본문 바로가기

Entity Framework

(3)
EF4 사용시 Navigation Property 로딩 EF4에서는 DB의 관계가 Navigation Property로 표현이 되는데요, 아래와 같은 방법으로 데이터를 로딩해서 개체의 데이터를 채울 수 있습니다. public teb_plan_request GetCPAPlanRequestBySeq(int requestSeq) { { using (edubankEntities edubank = new edubankEntities()) { teb_plan_request tpr = edubank.teb_plan_request.FirstOrDefault(x => x.request_seq == requestSeq); edubank.LoadProperty(tpr, "aaaa"); edubank.LoadProperty(tpr, "bbbb"); edubank.LoadPrope..
EneityFrame Key로 Delete하기 EntityFrameWork를 사용하여 Delete하기 using (clscEntities context = new clscEntities()) { foreach (var item in input) { tcl_process_category_study model = new tcl_process_category_study { category_no = item.CategoryNo, company_seq = companySeq, study_cd = item.ProcessCd, study_type = item.StudyType }; context.tcl_process_category_study.Attach(model); context.ObjectStateManager.ChangeObjectState(model, ..
IEnumerable<T> vs IQueryable<T> Linq Entity Framework 을 사용하면서 어떤분이 아래와 같이 선언하고 linq식을 만든걸 봤다. IEnumeralbe a = objectContext.userInfo; IEnumeralbe b = objectContext.userDetail; var temp = from item in a join item2 in b on a.userKey = b.userKey where a.userId= 'xxxx' select item int count = temp.Count(); 쿼리가 생각이 안나 위의 같이 막 짜봤다. 그럼 위의 코드에서 어떤일이 발생할까. 기본적으로 IEnumerable 에서의 쿼리는 메모리상에서의 쿼리를 실행하게 된다. 그러나 어떤 개발자들은 그부분을 이지하지 못해 위와 같이 코딩하고 만..