使用Silverlight RIA服务DomainDataSource按用户查询

发布于 2024-09-12 08:58:20 字数 490 浏览 2 评论 0原文

因此,我使用 SL4 业务模板和 SQL 会员 API。我创建了一个用户,并创建了一个与该用户关联的自定义表。

所以我想要一个数据网格来显示当前(WebContext.Current.User)用户的项目。

  1. 为什么用户的 GUID 是在 WebContext.Current.User 中???我需要它来加入“Items”表。

  2. 我如何使用XAML DomainDatasource...据我所知,只有当您可以绑定到XAML上的其他内容时才能使用它..例如,如果我在页面上有一个日历控件,我可以绑定domaindatasource到日历....但我想查询给出“UserID (GUID)”...那么我是否需要在 XAML 上放置一个带有该值的隐藏字段才能访问它? (就像asp.net中的隐藏文件)

或者我是否以错误的方式处理这一切...这是一个非常简单的概念..我有用户..我有项目..有一种关系..我想要一个数据网格填充了特定用户的项目。

So I am using the SL4 Business Template and the SQL Membership API. I created a user and I created a custom table that ties to that user.

So I want to have a datagrid that show the item for the CURRENT (WebContext.Current.User) user.

  1. Why is the GUID for the user in WebContext.Current.User??? I need that to join to the 'Items' table.

  2. How can I use the XAML DomainDatasource... from what I see you can only use it if you can bind to something else on the XAML.. for example if I have a calendar control on the page I can bind the domaindatasource to the calendar.... But I want to query giving the 'UserID (GUID)'... so do I need to put a hidden field on the XAML with that value to have access to it? (like the hidden fileds in asp.net)

or am I going about it all the wrong way... its a really simple conceopt.. I have users.. I have items.. there is a relationship.. and I want a datagrid filled with items for a particular user.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

青丝拂面 2024-09-19 08:58:20

有两种方法可以解决这个问题。首先,您可以编写一个查询 GetDataForCurrentUser() 并提取服务器上的当前用户。这往往是更安全的选择,因为用户只能获取自己的数据。第二个选项是将用户 GUID 作为参数传递。在这篇文章中,我展示了几种方法来做到这一点。

http://jeffhandley.com/archive/2010/03/ 18/自定义过滤参数.aspx

There are two ways to approach this. First, you could just write a query GetDataForCurrentUser() and pull the current user on the server. This tends to be the more secure option since a user can only get their own data. The second option is to pass the user guid as a parameter. In this post, I show a couple ways to do just that.

http://jeffhandley.com/archive/2010/03/18/custom-filter-parameter.aspx

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文