简体   繁体   English

Silverlight DomainService返回自定义类

[英]Silverlight DomainService returning custom class

I'm a relatively new user with silverlight. 我是一个相对较新的silverlight用户。 Here is my situation 这是我的情况

I'm using RIA DomainServices for bringing in all my data. 我正在使用RIA DomainServices来引入我的所有数据。 I can see, and bind to all the data needed. 我可以看到,并绑定到所需的所有数据。 I have a table that uses lookups to columns in another table for mapping its values. 我有一个表使用查找到另一个表中的列来映射其值。

For ex- In the user profile table, the values for user preferences, gender preferences are looked up from the corresponding columns in another table. 例如,在用户配置文件表中,将从另一个表中的相应列中查找用户首选项,性别首选项的值。 Like user preference value 23 is looked up from another table, and corresponding text value has to be displayed 从另一个表中查找用户偏好值23,并且必须显示相应的文本值

Now since, I don't want to change a lot of things in the project, how do I proceed with the issue? 既然如此,我不想改变项目中的很多东西,我该如何处理这个问题呢? Can I write a custom class that does hard - coded lookups in the get and sets? 我可以编写一个自定义类,在get和sets中进行硬编码查找吗? If yes, how do I proceed to get data from the domainservice for the custom class. 如果是,我如何继续从域服务获取自定义类的数据。

I hope I'm clear with the question 我希望我对这个问题很清楚

You can write your custom class, but you need to do: 您可以编写自定义类,但需要执行以下操作:

  1. Your class must be a primary key (mark a property with the attribute [key] 您的类必须是主键(使用属性[key]标记属性
  2. Create in your domain class a function that query your class. 在您的域类中创建一个查询您的类的函数。

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

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