2017-09-22 4 views
1

C#에서 AS400 프로그램을 매개 변수와 함께 호출하려고합니다. 이 순간 내가 실행을 이야기 할 때C#에서 매개 변수가있는 As400 프로그램을 호출하십시오.

public interface IRepository<T> : IReadOnlyRepository<T> where T : class 
    { 
     void Add(T item); 
     void Add(IEnumerable<T> items); 
     void Attach(T item); 
     void EnrollInUnitOfWork(IUnitOfWork unitOfWork); 
     int Execute(string command, params object[] parameters); 
     IEnumerable<T> ExecWithStoreProcedure(string query, params object[] parameters); 
     IQueryable<T> FindBy(Func<T, bool> predicate); 
     IQueryable<T> FindBy(Func<T, bool> predicate, params Expression<Func<T, object>>[] includes); 
     void Remove(T item); 
     void Remove(IEnumerable<T> items); 
     void Update(T item); 
    } 

가 어떻게 매개 변수를 추가 내 IRepository 인터페이스의 일부 실행 소위

myRepository.Execute($"Call {Settings.As400ProgramLibrary}.EAPP100CL"); 

같은 프로그램을 호출 할 수 있어요? 나는 HERE를 보았지만 다른 방법이 있는지 궁금해하고있었습니다.

답변

1

호출 문자열이 AS400 명령 줄에 입력하는 것과 같습니다. 그렇다면 CALL 명령에 PARM 키워드를 사용하십시오. 당신은 또한 15,5 진수와 같은 다른 유형으로 값을 전달할 수 있지만이 조각에서

myRepository.Execute($"CALL PGM({Settings.As400ProgramLibrary}.EAPP100CL) PARM('{Parameter1}' '{Parameter2}')"); 

, 나는 종종 가장 쉬운 방법 인 인용 문자열로 매개 변수를 전달하는 작은 따옴표를 추가했습니다. 필자는 PGM 키워드를 명시 적으로 추가했다.

자세한 내용은 CL 설명서를 참조하십시오. CALL command