Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>There are several points I'd like to comment on.</p> <p>Firstly, it is better not to return from a function like above. This is because you lose the benefit of being able to edit and update data. You should return IQueryable instead. Generate some code using EF to have a feel for it. </p> <p>Secondly, instead of setting DataContext, the ItemsSource on the DataGrid instead.</p> <pre><code>Dim gridData = x.GetGridData() grdSubmissions.ItemsSource= gridData </code></pre> <p>Thirdly, you should also step through Silverlight code and make sure gridData contains values. From first observation, it doesn't look correct because Silverlight is asynchronous. The code to fetch data from grid should look like:</p> <pre><code>Dim domainContext = new MyDomainContext() AddHandler domainContext.Completed, Sub (op) grdSubmissions.ItemsSource = domainContext.Submissions End Sub domainContext.Load(domainContext.GetSubmissionQuery()) </code></pre> <p>You are best working through this example: <a href="http://blogs.msdn.com/b/kylemc/archive/2011/04/29/mvvm-pattern-for-ria-services.aspx" rel="nofollow">http://blogs.msdn.com/b/kylemc/archive/2011/04/29/mvvm-pattern-for-ria-services.aspx</a> as the original Ria Services code is the bare minimum, and needs more convenience methods.</p> <p><b>Update 1 - DomainService</b></p> <pre><code>namespace SampleDataClass.Web.Services { using System; using System.Collections.Generic; using System.ComponentModel; using System.ComponentModel.DataAnnotations; using System.Linq; using System.ServiceModel.DomainServices.Hosting; using System.ServiceModel.DomainServices.Server; public class Customer { [Key] public int CustomerId { get; set; } public string Name { get; set; } public string Address { get; set; } } // TODO: Create methods containing your application logic. [EnableClientAccess()] public class DomainService1 : DomainService { [Query] public IQueryable&lt;Customer&gt; GetCustomers() { return (new Customer[] { new Customer() { CustomerId=1, Name="Luigina Davide", Address="Via Giulio Petroni, 82 24050-Palosco BG" }, }).AsQueryable&lt;Customer&gt;(); } } } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload