WF learning memo (3)

Source: Internet
Author: User

Persistence (msdn ):

Instanceview class: indicates an instance view. For example, the execute (instancehandle, instancepersistencecommand, timespan) method can return an instanceview object that provides a view of instance data in the permanent storage area.

Each instanceview object is associated with instancehandle. For instanceview returned from instancestore. Execute, the associated handle is the handle passed to execute. For instanceview returned from instancepersistencecontext. instanceview, the associated handle is the handle passed to trycommand.

At any given time, instancehandle can have 0 or more associated instanceview objects. The instanceview object returned from instancestore. Execute is unchangeable and indicates that snapshots of the Instance status are known after the command is successfully executed. The instanceview object returned from instancepersistencecontext is mutable and indicates the status of the currently known instance because it will be updated continuously during the execution of this command. (If the command fails, the intermediate state is discarded ).

public InstanceView Execute(InstanceHandle handle,InstancePersistenceCommand command,TimeSpan timeout)
 
 
Handle
Type: system. runtime. durableinstancing. instancehandle
An instance handle.
Command
Type: system. runtime. durableinstancing. instancepersistencecommand
The command to be executed.
Timeout
Type: system. timespan
The timeout value for this operation.
Return Value Type: system. runtime. durableinstancing. instanceview
An instanceview object, indicating the known status of the instance after the command is successfully completed. If execute is called in a transaction, this status can contain uncommitted data. Once the transaction is successfully committed, the data in the instanceview object is considered to have been committed. For example:
 static InstanceStore instanceStore;
instanceStore =  new SqlWorkflowInstanceStore(@"Data Source=.;Initial Catalog=WF4;uid=sa;pwd=123456;Asynchronous Processing=True");
 InstanceHandle handle = instanceStore.CreateInstanceHandle();            
 InstanceView view = instanceStore.Execute(handle, new CreateWorkflowOwnerCommand(), TimeSpan.FromSeconds(30));          
 handle.Free();
instanceStore.DefaultInstanceOwner = view.InstanceOwner;
...........
application.InstanceStore = instanceStore;




Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.