This question is locked. New answers and comments are not allowed.
Hi,
I am fairly new to ORM and I need answer for the following questions:
1. Is it possible to populate objects when a stored procedure is returning list of fields from 2 different table. For example, if I have a Stored Procedure as follows:
<P><FONT color=#0000ff size=2><FONT color=#0000ff size=2> </P> <P>ALTER</FONT></FONT><FONT size=2> </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>PROCEDURE</FONT></FONT><FONT size=2> [dbo]</FONT><FONT color=#808080 size=2><FONT color=#808080 size=2>.</FONT></FONT><FONT size=2>[usp_GetAllJobs]</P> <P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>AS</P> <P>BEGIN</P></FONT></FONT><FONT size=2> <P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>SELECT</FONT></FONT><FONT size=2> J</FONT><FONT color=#808080 size=2><FONT color=#808080 size=2>.</FONT></FONT><FONT size=2>Name</FONT><FONT color=#808080 size=2><FONT color=#808080 size=2>,</FONT></FONT><FONT size=2> J</FONT><FONT color=#808080 size=2><FONT color=#808080 size=2>.</FONT></FONT><FONT size=2>JobId</FONT><FONT color=#808080 size=2><FONT color=#808080 size=2>,</FONT></FONT><FONT size=2> JTA</FONT><FONT color=#808080 size=2><FONT color=#808080 size=2>.</FONT></FONT><FONT size=2>Type</FONT><FONT color=#808080 size=2><FONT color=#808080 size=2>,</FONT></FONT><FONT size=2> JTA</FONT><FONT color=#808080 size=2><FONT color=#808080 size=2>.</FONT></FONT><FONT size=2>AudioQuality </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>from</FONT></FONT><FONT size=2> Jobs J</P> <P></FONT><FONT color=#808080 size=2><FONT color=#808080 size=2>Left</FONT></FONT><FONT size=2> </FONT><FONT color=#808080 size=2><FONT color=#808080 size=2>Join</FONT></FONT><FONT size=2> Jobs_TranscriptionAttributes JTA </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>on</FONT></FONT><FONT size=2> J</FONT><FONT color=#808080 size=2><FONT color=#808080 size=2>.</FONT></FONT><FONT size=2>Jobid</FONT><FONT color=#808080 size=2><FONT color=#808080 size=2>=</FONT></FONT><FONT size=2>JTA</FONT><FONT color=#808080 size=2><FONT color=#808080 size=2>.</FONT></FONT><FONT size=2>Jobid</P> <P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>END</FONT></FONT></P>
Now when I execute the SP using the code given below only the properties of Object "Job" gets populated.
<FONT face=Consolas color=#2b91af size=2><FONT face=Consolas color=#2b91af size=2><FONT face=Consolas color=#2b91af size=2>Job</FONT></FONT></FONT><FONT face=Consolas size=2><FONT face=Consolas size=2>[] allJobs = ED.ExecuteStoredProcedure<</FONT></FONT><FONT face=Consolas color=#2b91af size=2><FONT face=Consolas color=#2b91af size=2><FONT face=Consolas color=#2b91af size=2>Job</FONT></FONT></FONT><FONT face=Consolas size=2><FONT face=Consolas size=2>>(</FONT></FONT><FONT face=Consolas color=#a31515 size=2><FONT face=Consolas color=#a31515 size=2><FONT face=Consolas color=#a31515 size=2>"usp_GetAllJobs"</FONT></FONT></FONT><FONT face=Consolas size=2><FONT face=Consolas size=2>, </FONT></FONT><FONT face=Consolas color=#0000ff size=2><FONT face=Consolas color=#0000ff size=2><FONT face=Consolas color=#0000ff size=2>null</FONT></FONT></FONT><FONT face=Consolas size=2><FONT face=Consolas size=2>, </FONT></FONT><FONT face=Consolas color=#0000ff size=2><FONT face=Consolas color=#0000ff size=2><FONT face=Consolas color=#0000ff size=2>null</FONT></FONT></FONT><FONT face=Consolas size=2><FONT face=Consolas size=2>);<BR></FONT></FONT><FONT face=Consolas color=#2b91af size=2><FONT face=Consolas color=#2b91af size=2><FONT face=Consolas color=#2b91af size=2>Console</FONT></FONT></FONT><FONT face=Consolas size=2><FONT face=Consolas size=2>.WriteLine(allJobs[0].Jobs_BillingInformations[0].OnlineTransReference );</FONT></FONT>I need a way to automatically populate "Jobs_BillingInformations" Object too.
2. Is it possible to execute a SP which returns more than 1 datatable? I could not find a working sample which can accomplish this.
Thanks.