自回归类中的两个已定义的类

自回归类中的两个已定义的类

本文介绍了WCF RIA服务 - 自回归类中的两个已定义的类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用EF 4的Silverlight / WCF RIA Services应用程序。目前,有一个域服务返回两种类型的类,OrderItem和Event。我想创建一个包含这两个项目的类,以便更容易地在XAML级别处理数据。这是组合这两个类的类看起来像:

I have a Silverlight / WCF RIA Services application that uses EF 4. Currently, there is a domain service that returns two types of classes, OrderItem and Event. I'd like to create a class that contains both of these items for easier manipulation of the data at the XAML level. Here is what the class that combines the two classes looks like:

[Serializable]
[DataContract]
public partial class EventOrderItem  {
    [Key]
    [DataMember]
    public string EventOrderItemKey { get { return Event.EventID.ToString() + "-" + OrderItem.OrderItemID.ToString(); } }

    [DataMember]
    public Event Event { get; set; }

    [DataMember]
    public OrderItem OrderItem { get; set; }
}

域服务返回EventOrderItem,但Event和OrderItem属性在课上。

The domain service returns the EventOrderItem, but the Event and OrderItem properties are not present on the class. How do I get RIA Services to pick up on these two properties?

推荐答案

根据您的评论,不幸的是,这是不可能的我是RIA服务最大的bugbears之一)。根据RIA Services UserVoice网站(http://dotnet.uservoice.com/forums/57026-wcf-ria-services),他们正在努力启用复杂类型,但目前你运气不好: (

As per your comment, unfortunately it's not possible (it's one of my biggest bugbears with RIA Services). According to the RIA Services UserVoice site (http://dotnet.uservoice.com/forums/57026-wcf-ria-services) they're working on enabling complex types now, but for the time being you're out of luck :(.

希望这有助于...

Chris

这篇关于WCF RIA服务 - 自回归类中的两个已定义的类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-21 12:25