title: How to databind DbContext SqlQuery() results in WPF
body: <p>I am trying to bind results returned from queries with dynamic where clauses to a WPF DataGrid.</p>
  
  <p>Using Database.SqlQuery there seems to be no Load() method and no Local() to return an ObservableCollection.
  Thus I am using New ObservableCollection(Of Product)(q1).
  Is this the recommended usage, or am I missing something?</p>
  
  <p>Using DbSet.SqlQuery I found no way to get at the data at all.
  How is this supposed to be used?</p>
  
  <pre><code>Dim _dbc As New AdventureWorksEntities
  
  ''Using DbSet
  'Dim q = _dbc.Product
  'q.Load()
  'Dim r = q.Local
  'grd.ItemsSource = r
  
  Const sql = "select * from production.product WHERE name LIKE 'fla%' and ProductNumber LIKE '%0'"
  'Using Database.SqlQuery
  Dim q1 = _dbc.Database.SqlQuery(Of Product)(sql)
  Dim r1 = New ObservableCollection(Of Product)(q1)
  grd.ItemsSource = r1
  
  ''Using DbSet.SqlQuery
  'Dim q2 = _dbc.Product.SqlQuery(sql)
  ''Dim r2 = ???
  ''grd.ItemsSource = r2
  </code></pre>