title: VB.Net: How to use an Object data source in report (.rdlc)
body: <p>My question is similar to <a href="https://stackoverflow.com/questions/1514965/rdlc-reporting-bound-to-object-data-source-in-three-layer-application">this one</a> but I'm having some problems with the actual implementation. </p>
  
  <p>I've got a report (.rdlc) in the business layer of a 3-tier app.</p>
  
  <p>I've got an object in the BL (<code>EmployeeManager</code>) which has a <code>GetEmployees(Expression as Expression(Of Func(Of Employee, Boolean))) As IQueryable(Of Employee)</code> method.</p>
  
  <p>As I didn't want to try and pass a lambda in directly (at least not until I've got something working), I've created a <code>ReportData</code> class in the BL which wraps the <code>GetEmployees()</code> call and exposes the results as an IEnumerable(Of Employee) - which should be very simple. It doesn't even have parameters at the moment.</p>
  
  <p>Ok... So In my report, I've tried to add a new Data Source. I've picked a type of <code>Object</code> and located the <code>ReportData</code> class mentioned above. The wizard completes and adds a DataSources folder to the project inside which is some XML defining a <code>&lt;GenericObjectDataSource&gt;</code> and pointing at the <code>Report</code> class.</p>
  
  <p><code>ReportData</code> also appears in the Data Sources pane - It has a <code>&gt;</code> next to it but when I expand it, it has no children.</p>
  
  <p>What I don't know how to do is USE the data source - It doesn't seem to expose any methods/members (I haven't even specified that it should call <code>GetEmployees()</code> yet!) and I certainly can't see an <code>IEnumerable(Of Employee)</code> anywhere.</p>
  
  <p>When I try to add a table to the report and it prompts me to select a Dataset, the ReportData Datasource is not shown in the Data source drop-down.</p>
  
  <p>What am I missing? Can someone please point me in the right direction?</p>
  
  <p>My simple ReportData object:</p>
  
  <pre class="lang-vb prettyprint-override"><code>Namespace Reports
      Public Class ReportData
  
          Private Property EmployeeManager As Interfaces.IEmployeeManager
  
          Public Sub New()
              ''This sub is here in case it's an instantiation problem - I intend to use dependency injection when I've got this working properly.
              Me.EmployeeManager = New EmployeeManager
          End Sub
  
          Public Sub New(ByVal EmployeeManager As Interfaces.IEmployeeManager)
              Me.EmployeeManager = EmployeeManager
          End Sub
  
          Public Function GetEmployees() As IEnumerable(Of Employee)
              Return EmployeeManager.GetEmployees()
          End Function
      End Class
  End Namespace
  </code></pre>
  
  <p>I've also found <a href="http://www.gotreportviewer.com/objectdatasources/index.html" rel="nofollow noreferrer">this</a> which seems to indicate I'm following the correct steps but the properties don't appear as expected </p>
  
  <blockquote>
    <p>The public properties of the class now appear in the Data Sources window, where they can be dragged and dropped into the report.</p>
  </blockquote>
  
  <p>This doesn't happen - the properties never appear</p>
  
  <p><strong>EDIT</strong>: As pointed out by Alex, I need to use <strong>properties</strong> not just any methods. Please see Alex Esselfie's answer below for clarification. This still hasn't solved my problem but has got me a step closer...</p>