anthonyhollings wrote:
daelmo wrote:
anthonyhollings wrote:
Does anyone have any sample code for Fetching and Saving entities using the SimpleRetryRecoveryStrategy with SelfServicing?
Hi Anthony. It's specified in the docs: Usage: manually specifying strategy with a query
anthonyhollings wrote:
Also filling a typed list?
See this.
I've seen the documentation, hence why I'm here looking for some additional assistance.
The documentation is brief at best and has limited practical examples. Really, the only example provided is a lync query in c#.
'brief' ? It's apparently so verbose you missed a spot in the brief snippet of text, namely
or can be set automatically once and be used for all queries from then on (Adapter). This means for SelfServicing the strategies are not 'set-and-forget' but require you to add code to be able to recover a given database action.
So in other words, for selfservicing you have to use the Execute() method to execute whatever you want to do within the strategy. It's really very very simple, so there's little else to tell:
1) (adapter only) you set the strategy to use in the adapter, then execute queries as normal
2) (adapter and selfservicing) use the pattern:
strategyInstance.Execute(()=><query method>)
where <query method> is like you'd normally fetch something, e.g. a typed list fill:
var strategy = new SqlAzureRecoveryStrategy(); // use defaults
OrderCustomerTypedList orderCustomer = new OrderCustomerTypedList();
IPredicateExpression filter = new PredicateExpression(CustomerFields.Country == "Brazil");
ISortExpression sorter = new SortExpression(OrderFields.Freight | SortOperator.Ascending);
strategy.Execute(()=>orderCustomer.Fill(0, sorter, true, filter));
as the strategy call is simply wrapped around the query you want to execute. There's little more to tell, as that's basically it.
How do I fill a typed list using a SimpleRetryRecoveryStrategy in Self Servicing?
How do I fetch and save entities using the SimpleRetryRecoveryStrategy in Self Servicing?
The 'brief' documentation regarding strategies clearly specifies how things work, under the section 'Usage: manually specifying strategy with a query'. The linq query there is an example, as the code clearly specifies a lambda ()=>something, where something can be anything as the code illustrates.
Your link to using typed lists contains absolutely no information in regard to a recovery strategy.
Indeed, because that would mean the combination of every single feature aspect which can be used with every other feature aspect has to be documented separately and we'd still be writing the documentation for v1.0.