2017-03-13 1 views
0

TeamId 인 int 매개 변수를 반환하는 Entity Framework 저장소 프로 시저를 사용하여 레코드를 삽입하는 논리를 작성했습니다. 저장 프로 시저에 대한 함수 가져 오기를 만들었습니다. 나는 INT 매개 변수를 반환하는 방법을 잘 모르겠습니다반환 매개 변수가있는 엔터티 프레임 워크를 사용하여 저장 프로 시저 삽입 호출

enter image description here

아래 스크린 샷을 참조하십시오. 프로 시저가 ObjectResult<T>이다에서 돌아 오기 무엇

DATAACCESS 층

public int InsertTeam(string countryCode, string teamName, string TeamDescription, string createdBy, char isActive) 
     { 
      using (var mcrContext = new MCREntities()) 
      { 
       return (from team in mcrContext.InsertTeam(countryCode, teamName, TeamDescription, createdBy, true) 


         select 
         { 


         }).ToList(); 
      } 

답변

0

아래의 코드를 참조하십시오. 귀하의 상황에서 간단히 :

public int InsertTeam(string countryCode, string teamName, string TeamDescription, string createdBy, char isActive) 
{ 
    using (var mcrContext = new MCREntities()) 
    { 
     var result = mcrContext.InsertTeam(countryCode, teamName, TeamDescription, createdBy, true); 
     return result.Single().Value; 
    } 
} 
관련 문제