<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://forums.silverlight.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>WCF RIA Services</title><link>http://forums.silverlight.net/forums/53.aspx</link><description>A forum for discussing the client and server pieces that make up the WCF RIA Services framework for Silverlight</description><dc:language>en</dc:language><generator>CommunityServer 2007 (Build: 20416.853)</generator><item><title>Re: how to get data from the server</title><link>http://forums.silverlight.net/forums/thread/244739.aspx</link><pubDate>Wed, 08 Jul 2009 17:32:06 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:244739</guid><dc:creator>samw</dc:creator><slash:comments>0</slash:comments><comments>http://forums.silverlight.net/forums/thread/244739.aspx</comments><wfw:commentRss>http://forums.silverlight.net/forums/commentrss.aspx?SectionID=53&amp;PostID=244739</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Excellent! Thank you Theo.&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: how to get data from the server</title><link>http://forums.silverlight.net/forums/thread/244409.aspx</link><pubDate>Wed, 08 Jul 2009 07:24:21 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:244409</guid><dc:creator>theo67</dc:creator><slash:comments>0</slash:comments><comments>http://forums.silverlight.net/forums/thread/244409.aspx</comments><wfw:commentRss>http://forums.silverlight.net/forums/commentrss.aspx?SectionID=53&amp;PostID=244409</wfw:commentRss><description>&lt;p&gt;Have you tried binding to the Context.Feedbacks?&lt;/p&gt;&lt;pre class="coloredcode"&gt;Context.Loaded += &lt;span class="kwd"&gt;new&lt;/span&gt; EventHandler&amp;lt; System.Windows.Ria.Data.LoadedDataEventArgs &amp;gt;(OnDataLoaded);
IQueryable query = Context.FeedbackViews.AsQueryable().Where(f =&amp;gt; f.FeedbackID &amp;lt; 7);
Context.LoadFeedbackView(query,&lt;span class="kwd"&gt;null&lt;/span&gt;);
...
&lt;span class="kwd"&gt;void&lt;/span&gt; OnDataLoaded(&lt;span class="kwd"&gt;object&lt;/span&gt; sender, System.Alexandria.Data.Client.DataLoadedEventArgs e)
{
Context.Loaded -= &lt;span class="kwd"&gt;new&lt;/span&gt; EventHandler&amp;lt; System.Windows.Ria.Data.LoadedDataEventArgs &amp;gt;(OnDataLoaded);
 dg.ItemsSource = Context.Feedbacks;
}
&lt;/pre&gt;&amp;nbsp; 
&lt;p&gt;This LoadFeedbackView() will result in an async request, so the Context.Feedbacks won&amp;#39;t be populated immediately. &lt;/p&gt;</description></item><item><title>Re: how to get data from the server</title><link>http://forums.silverlight.net/forums/thread/244351.aspx</link><pubDate>Wed, 08 Jul 2009 05:26:06 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:244351</guid><dc:creator>samw</dc:creator><slash:comments>0</slash:comments><comments>http://forums.silverlight.net/forums/thread/244351.aspx</comments><wfw:commentRss>http://forums.silverlight.net/forums/commentrss.aspx?SectionID=53&amp;PostID=244351</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Thanks all for the replies.&amp;nbsp; I was on vacation this weekend. &amp;nbsp;&lt;br /&gt;OK here is what I did.&amp;nbsp; It mostly works but I&amp;#39;m not sure it&amp;#39;s the best way.&amp;nbsp; The problem I&amp;#39;m having is using the IQueryable object. See commented section of code where I set the ItemsSource of the datagrid.&lt;br /&gt;&lt;br /&gt;1.) Server:&amp;nbsp; Made a file for my &amp;quot;...View&amp;quot; classes:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;pre class="coloredcode"&gt;&lt;span class="kwd"&gt;namespace&lt;/span&gt; PersonalWebsite1.Web&lt;br /&gt;{&lt;br /&gt;    &lt;span class="kwd"&gt;public class&lt;/span&gt; FeedbackView&lt;br /&gt;    {&lt;br /&gt;        [Key]&lt;br /&gt;        &lt;span class="kwd"&gt;public int&lt;/span&gt; FeedbackID { &lt;span class="kwd"&gt;get&lt;/span&gt;; &lt;span class="kwd"&gt;set&lt;/span&gt;; }&lt;br /&gt;        &lt;span class="kwd"&gt;public int&lt;/span&gt; ParentID { &lt;span class="kwd"&gt;get&lt;/span&gt;; &lt;span class="kwd"&gt;set&lt;/span&gt;; }&lt;br /&gt;        &lt;span class="kwd"&gt;public int&lt;/span&gt; ArticleID { &lt;span class="kwd"&gt;get&lt;/span&gt;; &lt;span class="kwd"&gt;set&lt;/span&gt;; }&lt;br /&gt;        &lt;span class="kwd"&gt;public string&lt;/span&gt; ArticleName { &lt;span class="kwd"&gt;get&lt;/span&gt;; &lt;span class="kwd"&gt;set&lt;/span&gt;; }&lt;br /&gt;        &lt;span class="kwd"&gt;public&lt;/span&gt; DateTime Date { &lt;span class="kwd"&gt;get&lt;/span&gt;; &lt;span class="kwd"&gt;set&lt;/span&gt;; }&lt;br /&gt;        &lt;span class="kwd"&gt;public string&lt;/span&gt; SenderName { &lt;span class="kwd"&gt;get&lt;/span&gt;; &lt;span class="kwd"&gt;set&lt;/span&gt;; }&lt;br /&gt;        &lt;span class="kwd"&gt;public string&lt;/span&gt; SenderIPAddress { &lt;span class="kwd"&gt;get&lt;/span&gt;; &lt;span class="kwd"&gt;set&lt;/span&gt;; }&lt;br /&gt;        &lt;span class="kwd"&gt;public string&lt;/span&gt; Comment { &lt;span class="kwd"&gt;get&lt;/span&gt;; &lt;span class="kwd"&gt;set&lt;/span&gt;; }&lt;br /&gt;        &lt;span class="kwd"&gt;public bool&lt;/span&gt; Approved { &lt;span class="kwd"&gt;get&lt;/span&gt;; &lt;span class="kwd"&gt;set&lt;/span&gt;; }&lt;br /&gt;    }&lt;br /&gt;}&lt;/pre&gt;
2.) Server: marked my DomainService class with the partial modifer (Why is this class not generated with the partial modifier?).&amp;nbsp; Created another file, same class, like this: &lt;br /&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;pre class="coloredcode"&gt;&lt;span class="kwd"&gt;namespace&lt;/span&gt; PersonalWebsite1.Web&lt;br /&gt;{&lt;br /&gt;    &lt;span class="kwd"&gt;public&lt;/span&gt; partial &lt;span class="kwd"&gt;class&lt;/span&gt; PersonalWebsiteDomainService : LinqToEntitiesDomainService&lt;br /&gt;&lt;br /&gt;    {&lt;br /&gt;        &lt;span class="kwd"&gt;public&lt;/span&gt; IQueryable GetFeedbackView()&lt;br /&gt;        {&lt;br /&gt;            var query = (from f &lt;span class="kwd"&gt;in&lt;/span&gt; Context.Feedback&lt;br /&gt;                join a &lt;span class="kwd"&gt;in&lt;/span&gt; Context.Articles on f.ArticleID equals a.ArticleID&lt;br /&gt;                select &lt;span class="kwd"&gt;new&lt;/span&gt; FeedbackView&lt;br /&gt;                {&lt;br /&gt;                    FeedbackID = f.FeedbackID,&lt;br /&gt;                    ParentID = f.ParentID,&lt;br /&gt;                    ArticleID = f.ArticleID,&lt;br /&gt;                    ArticleName = a.Title,&lt;br /&gt;                    Date = f.Date,&lt;br /&gt;                    SenderName = f.SenderName,&lt;br /&gt;                    SenderIPAddress = f.SenderIPAddress,&lt;br /&gt;                    Comment = f.Comment,&lt;br /&gt;                    Approved = f.Approved&lt;br /&gt;                }).AsQueryable();&lt;br /&gt;            &lt;br /&gt;            &lt;span class="kwd"&gt;return&lt;/span&gt; query;&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;}&lt;/pre&gt;&amp;nbsp;&amp;nbsp;
&lt;p&gt;3) Client:&amp;nbsp; Set the ItemsSource of the datagrid as follows:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;pre class="coloredcode"&gt;&lt;span class="kwd"&gt;namespace&lt;/span&gt; PersonalWebsiteAdmin.Views&lt;br /&gt;{&lt;br /&gt;    &lt;span class="kwd"&gt;public&lt;/span&gt; partial &lt;span class="kwd"&gt;class&lt;/span&gt; FeedbackPage : BasePage&lt;br /&gt;    {&lt;br /&gt;        &lt;span class="kwd"&gt;public&lt;/span&gt; FeedbackPage()&lt;br /&gt;        {&lt;br /&gt;            InitializeComponent();&lt;br /&gt;            PersonalWebsiteDomainContext Context = &lt;span class="kwd"&gt;new&lt;/span&gt; PersonalWebsiteDomainContext();&lt;br /&gt;&lt;br /&gt;            &lt;span class="cmt"&gt;//Does not work.  &lt;/span&gt;&lt;br /&gt;            IQueryable query = Context.FeedbackViews.AsQueryable().Where(f =&amp;gt; f.FeedbackID &amp;lt; 7);&lt;br /&gt;            Context.LoadFeedbackView(query,&lt;span class="kwd"&gt;null&lt;/span&gt;);&lt;br /&gt;            dg.ItemsSource = query;&lt;br /&gt;            &lt;br /&gt;&lt;br /&gt;            &lt;span class="cmt"&gt;// Works&lt;br /&gt;            //Context.LoadFeedback();&lt;br /&gt;            //dg.ItemsSource = Context.Feedbacks;&lt;/span&gt;&lt;br /&gt;        }&lt;br /&gt;&lt;/pre&gt;&amp;nbsp;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: how to get data from the server</title><link>http://forums.silverlight.net/forums/thread/243280.aspx</link><pubDate>Mon, 06 Jul 2009 16:28:04 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:243280</guid><dc:creator>ippon11</dc:creator><slash:comments>0</slash:comments><comments>http://forums.silverlight.net/forums/thread/243280.aspx</comments><wfw:commentRss>http://forums.silverlight.net/forums/commentrss.aspx?SectionID=53&amp;PostID=243280</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Alternatively Sam, for a quick mock-up (unsecure), you can create xml as your data, and either embed it as a resource in your SL project, or use a webclient to retrieve it from a remote location via http.&amp;nbsp; You can then use your existing code to query the xml as an xmldatasource.&amp;nbsp; This not a productised solution but will get you up and running quickly to prototype the rest of your SL app.&lt;/p&gt;&lt;p&gt;&amp;nbsp;Michael&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;...Mark this as answer if it has been helpful.&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: how to get data from the server</title><link>http://forums.silverlight.net/forums/thread/242436.aspx</link><pubDate>Sat, 04 Jul 2009 06:52:35 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:242436</guid><dc:creator>theo67</dc:creator><slash:comments>0</slash:comments><comments>http://forums.silverlight.net/forums/thread/242436.aspx</comments><wfw:commentRss>http://forums.silverlight.net/forums/commentrss.aspx?SectionID=53&amp;PostID=242436</wfw:commentRss><description>&lt;p&gt;You need to call a&amp;nbsp;method on the context before you create &amp;quot;query&amp;quot; else &amp;quot;context.Feedback&amp;quot; will be empty. Normally you could create a LINQ-query and pass it to the DomainContext.&amp;nbsp;Another way is to implement a specific query method in the DomainService which will be exposed via the DomainContext and cal be called in your client. See the QueryAttribute. Anyway when you use the DomainDataSource you can declare this in XAML.&lt;/p&gt;
&lt;p&gt;Have you&amp;nbsp;considered using a viewmodel that wraps the PersonalWebsiteDomainContext, like &lt;a href="http://stackoverflow.com/questions/744474/combining-net-ria-services-and-mvvm-in-silverlight-3-0"&gt;http://stackoverflow.com/questions/744474/combining-net-ria-services-and-mvvm-in-silverlight-3-0&lt;/a&gt;. This way you move the query in the viewmodel.&lt;/p&gt;</description></item><item><title>Re: how to get data from the server</title><link>http://forums.silverlight.net/forums/thread/242402.aspx</link><pubDate>Sat, 04 Jul 2009 04:34:40 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:242402</guid><dc:creator>codenenterp</dc:creator><slash:comments>0</slash:comments><comments>http://forums.silverlight.net/forums/thread/242402.aspx</comments><wfw:commentRss>http://forums.silverlight.net/forums/commentrss.aspx?SectionID=53&amp;PostID=242402</wfw:commentRss><description>&lt;p&gt;you will have to write some type of service for the silverlight client to call and get the data.&amp;nbsp; The call to the server is async so dont be suprised.&lt;/p&gt;</description></item><item><title>how to get data from the server</title><link>http://forums.silverlight.net/forums/thread/241394.aspx</link><pubDate>Fri, 03 Jul 2009 06:05:23 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:241394</guid><dc:creator>samw</dc:creator><slash:comments>0</slash:comments><comments>http://forums.silverlight.net/forums/thread/241394.aspx</comments><wfw:commentRss>http://forums.silverlight.net/forums/commentrss.aspx?SectionID=53&amp;PostID=241394</wfw:commentRss><description>&lt;p&gt;How do I effect a transfer of data from the server to the client using the following code?&amp;nbsp; Do I need to write a method on the server side?&lt;/p&gt;&lt;p&gt;Note that the class FeedbackView does not exist in my DataModel. &lt;br /&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;pre class="coloredcode"&gt;&lt;span class="kwd"&gt;public&lt;/span&gt; FeedbackPage()&lt;br /&gt;        {&lt;br /&gt;            InitializeComponent();&lt;br /&gt;            &lt;br /&gt;            PersonalWebsiteDomainContext context = &lt;span class="kwd"&gt;new&lt;/span&gt; PersonalWebsiteDomainContext();&lt;br /&gt;            &lt;span class="kwd"&gt;this&lt;/span&gt;.DataContext = context;&lt;br /&gt;&lt;br /&gt;            List query = (from f &lt;span class="kwd"&gt;in&lt;/span&gt; context.Feedbacks&lt;br /&gt;                                        join a &lt;span class="kwd"&gt;in&lt;/span&gt; context.Articles on f.ArticleID equals a.ArticleID&lt;br /&gt;                                        select &lt;span class="kwd"&gt;new&lt;/span&gt; FeedbackView&lt;br /&gt;                                        {&lt;br /&gt;                                            FeedbackID = f.FeedbackID,&lt;br /&gt;                                            ParentID = f.ParentID,&lt;br /&gt;                                            ArticleID = f.ArticleID,&lt;br /&gt;                                            ArticleName = a.Title,&lt;br /&gt;                                            Date = f.Date,&lt;br /&gt;                                            SenderName = f.SenderName,&lt;br /&gt;                                            SenderIPAddress = f.SenderIPAddress,&lt;br /&gt;                                            Comment = f.Comment, &lt;br /&gt;                                            Approved = f.Approved&lt;br /&gt;                                        }).ToList();&lt;br /&gt;&lt;br /&gt;            dg.ItemsSource = query;&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        &lt;br /&gt;        &lt;span class="kwd"&gt;protected class&lt;/span&gt; FeedbackView&lt;br /&gt;        {&lt;br /&gt;            &lt;span class="kwd"&gt;public int&lt;/span&gt; FeedbackID {&lt;span class="kwd"&gt;get&lt;/span&gt;; &lt;span class="kwd"&gt;set&lt;/span&gt;;}&lt;br /&gt;            [Key]&lt;br /&gt;            &lt;span class="kwd"&gt;public int&lt;/span&gt; ParentID {&lt;span class="kwd"&gt;get&lt;/span&gt;; &lt;span class="kwd"&gt;set&lt;/span&gt;;}&lt;br /&gt;            &lt;span class="kwd"&gt;public int&lt;/span&gt; ArticleID {&lt;span class="kwd"&gt;get&lt;/span&gt;; &lt;span class="kwd"&gt;set&lt;/span&gt;;}&lt;br /&gt;            &lt;span class="kwd"&gt;public string&lt;/span&gt; ArticleName {&lt;span class="kwd"&gt;get&lt;/span&gt;; &lt;span class="kwd"&gt;set&lt;/span&gt;;}&lt;br /&gt;            &lt;span class="kwd"&gt;public&lt;/span&gt; DateTime Date {&lt;span class="kwd"&gt;get&lt;/span&gt;; &lt;span class="kwd"&gt;set&lt;/span&gt;;}&lt;br /&gt;            &lt;span class="kwd"&gt;public string&lt;/span&gt; SenderName {&lt;span class="kwd"&gt;get&lt;/span&gt;; &lt;span class="kwd"&gt;set&lt;/span&gt;;}&lt;br /&gt;            &lt;span class="kwd"&gt;public string&lt;/span&gt; SenderIPAddress {&lt;span class="kwd"&gt;get&lt;/span&gt;; &lt;span class="kwd"&gt;set&lt;/span&gt;;}&lt;br /&gt;            &lt;span class="kwd"&gt;public string&lt;/span&gt; Comment {&lt;span class="kwd"&gt;get&lt;/span&gt;; &lt;span class="kwd"&gt;set&lt;/span&gt;;}&lt;br /&gt;            &lt;span class="kwd"&gt;public bool&lt;/span&gt; Approved { &lt;span class="kwd"&gt;get&lt;/span&gt;; &lt;span class="kwd"&gt;set&lt;/span&gt;; }&lt;br /&gt;        }&lt;/pre&gt;&amp;nbsp;&amp;nbsp;</description></item></channel></rss>