Thursday, September 13, 2012

InvokeOperation returns System.Data.Objects.ObjectQuery'1[System.Char]'

InvokeOperation returns System.Data.Objects.ObjectQuery'1[System.Char]'

I have a silverlight/mvc app with is hooked up using RIA My code on the server returns the correct results, but in the silverlight app it returns System.Data.Objects.ObjectQuery'1[System.Char]'

Can anyone help with this problem.

My code is below:

namespace Web.UI.SilverlightDomainServices     {     using System;     using System.Collections.Generic;     using System.ComponentModel;     using System.ComponentModel.DataAnnotations;     using System.Data;     using System.Linq;     using System.ServiceModel.DomainServices.EntityFramework;     using System.ServiceModel.DomainServices.Hosting;     using System.ServiceModel.DomainServices.Server;     using Web.UI.Models;       // Implements application logic using the SilverlightDBEntities context.     // TODO: Add your application logic to these methods or in additional methods.     // TODO: Wire up authentication (Windows/ASP.NET Forms) and uncomment the following to disable anonymous access     // Also consider adding roles to restrict access as appropriate.     // [RequiresAuthentication]     [EnableClientAccess()]     public class VideoAdvertDomainService : LinqToEntitiesDomainService<SilverlightDBEntities>         {          // TODO:         // Consider constraining the results of your query method.  If you need additional input you can         // add parameters to this method or create additional query methods with different names.         // To support paging you will need to add ordering to the 'at_AdvertVideoAdvertisement' query.           string strMonthYear = DateTime.Now.ToString("MMMM-yyyy");            [Invoke]         public string GetMediaURLBasedOnMonthYear()             {             var t = (from p in this.ObjectContext.at_AdvertVideoAdvertisement                      where p.AdvertMediaMonthYear == strMonthYear                      select p.AdvertMediaURL.Single());              return t.ToString();             }           public IQueryable<at_AdvertVideoAdvertisement> GetAt_AdvertVideoAdvertisement()             {             return this.ObjectContext.at_AdvertVideoAdvertisement;             }         }     }   using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Windows; using System.Windows.Controls; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Animation; using System.Windows.Shapes; using Web.UI.SilverlightDomainServices; using Microsoft.SilverlightMediaFramework.Core.Media; using Microsoft.SilverlightMediaFramework.Core; using System.ServiceModel.DomainServices.Client; using System.Collections; using Web.UI.Models;  namespace Web.Silverlight     {     public partial class MainPage : UserControl         {         public MainPage()             {             InitializeComponent();             Loaded += new RoutedEventHandler(MainPage_Loaded);             }          private VideoAdvertDomainContext ctx = new VideoAdvertDomainContext();         InvokeOperation<string> str;          private void MainPage_Loaded(object sender, RoutedEventArgs e)             {              InvokeOperation<string> mURI = ctx.GetMediaURLBasedOnMonthYear();              string result;              mURI.Completed += (s, f) =>             {                 if (!mURI.HasError)                     {                     result = mURI.Value.ToString();                     //PlaylistItem item = new PlaylistItem();                     //item.MediaSource = new Uri(result.ToString());                     //item.DeliveryMethod = Microsoft.SilverlightMediaFramework.Plugins.Primitives.DeliveryMethods.AdaptiveStreaming;                     //MP.Playlist.Add(item);                     MessageBox.Show("Message:  " + result.ToString());                     }                 };              }         } 

Answers & Comments...




No comments:

Post a Comment

Send us your comment related to the topic mentioned on the blog