简体   繁体   English

RIA Services部分课程问题

[英]RIA Services partial class issue

In RIA Services I define some partial class for the entity. 在RIA Services中,我为实体定义了一些局部类。 (It is under *.shared.cs) (在* .shared.cs下)

This partial class has some new fields that doesn't have entity. 此局部类具有一些没有实体的新字段。

And I have a method to populate those fields of the entity including the extra partial class fields. 我有一种方法来填充实体的那些字段,包括额外的部分类字段。

When I debug that RIA Services method I can see that ALL Partial class fields are populated well. 当我调试该RIA Services方法时,我可以看到所有Partial类字段都被很好地填充。 So they are NOT NULL. 因此它们不是NULL。

When I get callback from RIA Services in Silverlight code (MVVM) I can see ALL fields: 当我从Silverlight代码(MVVM)的RIA服务获得回调时,我可以看到所有字段:

  1. Basic entities fields. 基本实体字段。
  2. Extra partial class fields. 额外的部分类字段。

!!! !!! But the partial class fields are NULL !!! 但是部分类字段为NULL !!!

What I am missing there? 我在那里想念什么? Any clue? 有什么线索吗?

Thank you! 谢谢!

在此处输入图片说明

请向部分类属性添加[DataMemberAttribute()]属性(System.Runtime.Serialization命名空间)。

Finally I found other way to realize things I need: 最终,我找到了实现我需要的东西的另一种方式:

I just created a SQL Server View and that's it! 我刚刚创建了一个SQL Server视图,就是这样! :) :)

So I recommend to use this approach. 因此,我建议使用这种方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM