2 개의 테이블이 있으며 Table1에는 기본 키 'CustomizationId'가 있으며 Table2에는 이에 맞는 FK Customizationid가 있습니다. Table2에는 기본 키가 없습니다.ADO.Net Entity Model의 다른 테이블에 외래 키가있는 테이블을 어떻게 업데이트합니까?
웹 기반 양식에서 새 레코드를 추가하려고합니다. 나는 데이터베이스에이를 저장하려고 내가 오류 얻을 : 내가 주석 라인에 추가할지 여부를 내가 오류를 얻고있다 SaveChanges를 호출하면
Customization customization = new Customization();
Code code = new Code();
customization.Name = CustomizationName.Text;
customization.LastUpdated = DateTime.Now;
code.Top = top_js.InnerText;
code.Bottom = bottom_js.InnerText;
//code.CustomizationId = customization.CustomizationId;
customization.Code = code;
entities.AddToCustomizations(customization);
entities.SaveChanges();
합니다.
Unable to update the EntitySet 'Code' because it has a DefiningQuery and no <InsertFunction> element exists in the <ModificationFunctionMapping> element to support the current operation.
이 상황을 어떻게 처리합니까? 사용자 정의에 추가하는 것과 동시에 코드를 추가하기 만하면됩니다. '코드'테이블에는 Customization이 Customization에 의해 설정된 PK/Identity로 설정되어야합니다.
아이디어가 있으십니까?