Я получаю эту ошибку от silverlight:
Операция с именем 'GetRssFeed' не соответствует требуемой подписи.Возвращаемые типы должны быть сущностью, коллекцией сущностей или одним из предопределенных сериализуемых типов.
Это мой класс обслуживания домена:
// TODO: Create methods containing your application logic.
[EnableClientAccess()]
public class RssService : DomainService
{
[Invoke]
public XDocument GetRssFeed(string Url)
//public string GetRssFeed(string Url)
{
XDocument RssFeed = XDocument.Load(Url);
return RssFeed.Document;//.ToString();
}
}
А это мой класс mainpage.xaml.cs:
public MainPage()
{
InitializeComponent();
RssContext context = new RssContext();
context.GetRssFeed("http://www.nu.nl/feeds/rss/algemeen.rss", GetRssFeedCompleted, null);
//XDocument RssFeed = XDocument.Load("http://www.nu.nl/feeds/rss/algemeen.rss");
}
void GetRssFeedCompleted(InvokeOperation<XDocument> obj)
{
//FeedResult.Text = obj.Value;
}
private IEnumerable<Channel> getChannelQuery(XDocument xdoc)
{
//XDocument xd = (XDocument)xdoc;
return from channels in xdoc.Descendants("channel")
select new Channel
{
Title = channels.Element("title") != null ? channels.Element("title").Value : "",
Link = channels.Element("link") != null ? channels.Element("link").Value : "",
Description = channels.Element("description") != null ? channels.Element("description").Value : "",
Items = from items in channels.Descendants("item")
select new Item
{
Title = items.Element("title") != null ? items.Element("title").Value : "",
Link = items.Element("link") != null ? items.Element("link").Value : "",
Description = items.Element("description") != null ? items.Element("description").Value : "",
Guid = (items.Element("guid") != null ? items.Element("guid").Value : "")
}
};
}
}
Если я изменяю тип возвращаемого значения XDocument в своем классе domainservice, я получаю эту ошибку.Но сделать это просто нормально.Я погуглил эту ошибку, есть некоторые обходные пути для пользовательских типов возвращаемых данных.Но это не обычай.Объект XDocument принадлежит .NET Framework.
Как я могу это исправить?