Anyone get Silverlight Ria Domain Service OutputCaching to work?
I am trying to use client side caching in silverlight by decorating a domain service in a RIA Service like so:
[OutputCache(OutputCacheLocation.Client,3600,UseSlidingExpiration = true)]
public IQueryable<State> GetMyStates()
{
return entities.States;
}
I am also using a DomainDataSource with a filter:
<riaControls:DomainDataSource.FilterDescriptors>
<riaControls:FilterDescriptor
Operator开发者_高级运维="StartsWith"
PropertyPath="StateCode"
Value="{Binding ElementName=txtElementName, Path=Text}" />
</riaControls:DomainDataSource.FilterDescriptors>
and I am not seeing any observable caching effects it goes back to the datasource both on any filter change and on every page refresh.
Has anyone gotten client side caching for Domains Services to work?
Output caching is disabled if you attempt to specify an additional LINQ query. You should change the above to use a query method that accepts a string parameter for the state name and then output cache on that.
[OutputCache(...)]
public IQueryable<State> GetMyStates(string stateNamePart)
{
return entities.States.Where(st => ...);
}
You can read further about the OutputCaching support at RIA Service Output Caching, towards the end of the article, he points out the limitation on not allowing further LINQ queries for caching to work.
精彩评论