Register(new BranchingOperation()
     .Add(Partial.Register(new FilterRecordsToAdd()).Register(new 
OutputCommandOperation{CommandText="insert into ..."}))
     .Add(Partial.Register(new FilterRecordsToUpdate()).Register(new 
OutputCommandOperation{CommandText="update ..."}));

Where FilterRecordsToAdd/Update are your implementations of 
AbstractOperation.  OutputCommandOperation (or something like that) is the 
built in operation to execute a write against the database.

On Sunday, June 17, 2012 10:22:48 AM UTC-4, John Strzempa wrote:

> Hi Simone,
>
> Thanks. That is what I was thinking but wanted to be sure.
>
> On Sunday, June 17, 2012 3:31:53 AM UTC-5, SimoneB wrote:
>>
>> Hello John,
>>
>> that't not how you'd usually do this, as executing an operation is more 
>> involved than just calling Execute on it - and it's why several executors 
>> exist in the library.
>> The idiomatic way to achieve the same is by branching the pipeline in 
>> two, whose entry points would be a updateProductOperation and 
>> addProductOperation. Their implementation would be the same as in your code 
>> except that the first would filter rows by row["ProductAction"] == "Update" 
>> and the second by != "Update".
>>
>> Hope this helps, Simone
>>
>>
>> I want to check the value of a row field value and depending on the value 
>>> run a specific operation. Can this be done. Part of the code is below
>>>
>>>     public override IEnumerable<Row> Execute(IEnumerable<Row> rows)
>>>         {
>>>             foreach (Row row in rows)
>>>             {
>>>                 if (row["ProductAction"] == "Update")
>>>                 {
>>>                     _updateProductOperation.Execute(rows);
>>>                 }
>>>                 else
>>>                 {
>>>                     _addProductOperation.Execute(rows);
>>>                 }
>>>
>>>                 yield return row;
>>>             }
>>>         }
>>>
>>> -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "Rhino Tools Dev" group.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msg/rhino-tools-dev/-/pLnVYjhuzqsJ.
>>> To post to this group, send email to [email protected].
>>> To unsubscribe from this group, send email to 
>>> [email protected].
>>> For more options, visit this group at 
>>> http://groups.google.com/group/rhino-tools-dev?hl=en.
>>>
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Rhino Tools Dev" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/rhino-tools-dev/-/7hF3ry1YRV4J.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rhino-tools-dev?hl=en.

Reply via email to