2016-08-04 2 views
0

은 (Npgsql 드라이버) PostgreSQL의 (9.5) 프로 시저를 감안 :PetaPoco에서 PostgreSQL 저장 프로 시저를 실행하는 방법 (Npgsql 사용)?

( patient_recid 정수 시간대없이 tencounter 타임 스탬프) SETOF가

을 view_dx RETURNS CREATE OR FUNCTION "GetAllDx"를 REPLACE

PetaPoco에서 어떻게 실행됩니까? 할 수 있습니까? (나는 Dapper를 사용 해왔다.)

도움을 주시면 감사하겠습니다. 혼합의 경우 프로 시저 이름

답변

0

매우 간단

[TestMethod] 
     public void GetAllPatientsWithServices() 
     { 
      // Create a PetaPoco database object 
      var db = new chaosDB("localconnection"); 

      // Calling stored procedure getallpatientswithservices() 
      var a = db.Fetch<view_patient>("Select * from getallpatientswithservices()"); 

      foreach(var b in a) 
      { 
       Console.WriteLine("{0} - {1}", b.cpatient, b.chart_number); 
      } 
     } 

또는 :

[TestMethod] 
     public void GetDxLibrary() 
     { 
      // Create a PetaPoco database object 
      var db = new chaosDB("localconnection"); 

      // Calling stored procedure with mixed case name 
      var a = db.Fetch<icd9>("Select * from \"GetDxLibrary\"()"); 

      foreach (var b in a) 
      { 
       Console.WriteLine("{0} - {1}", b.code,b.cdesc); 
      } 
     }