有人在 .NET RIA DomainDataService 和 POCO 方面取得过成功吗?
我有这个工作并获取数据。 但是,每次我寻呼时,它都会调用 GetAllWebExceptions,它会从数据库中获取所有 Web 异常记录。 分页应该如何实现? 我只见过 EntityFrameworks 的示例。 有人有一个使用 POCO 数据源的好例子吗?还是还会有?
<Grid x:Name="LayoutRoot" Background="White">
<ria:DomainDataSource x:Name="ErrorLogDataSource"
LoadMethodName="GetAllWebExceptions">
<ria:DomainDataSource.DomainContext>
<services:CMSContext />
</ria:DomainDataSource.DomainContext>
</ria:DomainDataSource>
<data:DataGrid x:Name="DataGridExceptions" ItemsSource="{Binding ElementName=ErrorLogDataSource, Path=Data}"
AutoGenerateColumns="True">
</data:DataGrid>
<dataControls:DataPager Source="{Binding Data, ElementName=ErrorLogDataSource}"
PageSize="20" />
在服务中:
[Query(PreserveName = true)] public IEnumerable GetAllWebExceptions() { return WebException.SelectAll("DATECREATED DESC"); }
I have this working and getting data. However, everytime I page it calls the GetAllWebExceptions, which gets all of the web exceptions records from the database. How should paging be implemented? I've only seen examples with EntityFrameworks. Does anyone have a good example using the data source with POCO or is that still to come?
<Grid x:Name="LayoutRoot" Background="White">
<ria:DomainDataSource x:Name="ErrorLogDataSource"
LoadMethodName="GetAllWebExceptions">
<ria:DomainDataSource.DomainContext>
<services:CMSContext />
</ria:DomainDataSource.DomainContext>
</ria:DomainDataSource>
<data:DataGrid x:Name="DataGridExceptions" ItemsSource="{Binding ElementName=ErrorLogDataSource, Path=Data}"
AutoGenerateColumns="True">
</data:DataGrid>
<dataControls:DataPager Source="{Binding Data, ElementName=ErrorLogDataSource}"
PageSize="20" />
in the service:
[Query(PreserveName = true)] public IEnumerable GetAllWebExceptions() { return WebException.SelectAll("DATECREATED DESC"); }
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您当然应该能够使用 POCO 类。 但是,您的查询方法需要通过返回通用 IEnumerable 来引用它,以便系统的其余部分在编译时知道您的类型。
要求是您的 POCO 类必须具有某种身份概念,由一个或多个用 [Key] 元数据属性标记的成员组成。
例如:
希望有帮助...
You should certainly be able to use a POCO class. However your query method needs to reference it by returning a generic IEnumerable, so the rest of the system knows at compile time of your type.
The requirement is your POCO class must have some notion of identity, made up of one or more members that are marked with the [Key] metadata attribute.
For example:
Hope that helps...
看看 Brad Abrams 的精彩演练 将 POCO 与 RIA 服务结合使用
Take a look at Brad Abrams excellent walk-through on using POCO with RIA Services