2017-08-02 85 views
1

我有兩個表患者和PatientStudy在我的數據庫中,由代碼第一個實體框架創建。 這些表格與studypatient表中的外鍵patient_id有關係。 我的代碼如下:如何我可以通過代碼c的stimulsoft報告創建主報告#

var patbus = new StiBusinessObjectData("Test", "Patient",Patients.ToArray()); 
     var studies=new List<PatientStudy>(); 
     foreach (var patientStudies in Patients.Studies.ToArray()) 
     { 
      studies.AddRange(patientStudies); 
     } 
     var studySrc = new StiBusinessObjectData("Test", "PatientStudy", studies); 
     report.BusinessObjectsStore.Add(studySrc); 
     report.BusinessObjectsStore.Add(patbus); 
     report.Dictionary.Synchronize(); 

     var pds = report.Dictionary.DataSources["Patient"]; 
     var sds = report.Dictionary.DataSources["PatientStudy"]; 
     StiDataRelation rel = new StiDataRelation("Studies", pds, sds, new string[] { "Id" }, new string[] { "Patient_Id" }); 

     report.Dictionary.RegRelation(rel); 
     report.Dictionary.Relations.Add(rel); 
     report.Dictionary.Synchronize(); 

     report.DesignWithWpf(); 

當我運行這段代碼,在stimulsoft設計視圖中的兩個業務對象數據(患者和patientstudy)添加,但他們之間的關係並不適用。 我需要幫助 謝謝

回答

0

在Business Objects和DataSource之間添加關係是不可能的。 應該有業務對象或數據源的結構。