googlebot
Buy Differin Gel Online
ADVERTISEMENT

Learn About Microsoft .NET Framework 3.5

  By Certification Magazine —

1 | 2 | 3 | 4 |

What should you do?

A.    Set the SessionId property to null in both the InvokeDebitWS and InvokeCreditWS activities.
B.    Set the SessionId property to the WorkflowInstanceId property in both the InvokeDebitWS and InvokeCreditWS activities.
C.    Add the following code to the SetAccountParams_ExecuteCode event handler:
     string sessionID = WorkflowInstanceId.ToString();
     InvokeDebitWS.SessionId = sessionID;
     InvokeCreditWS.SessionId = sessionID;
D.    Add the following code to the SetAccountParams_ExecuteCode event handler:
     string sessionID = new Guid().ToString();
     InvokeDebitWS.SessionId = sessionID;
     InvokeCreditWS.SessionId = sessionID;

Answer:
D

Tutorial:
To ensure that two InvokeWebServiceActivity activities use the same Web proxy instance, you should set the SessionId property to the same value. To ensure each iteration generates a unique session with a new Web service proxy, you should add a Code activity that executes code similar to the following:

string sessionID = new Guid().ToString();
InvokeDebitWS.SessionId = sessionID;
InvokeCreditWS.SessionId = sessionID;

This code ensures the InvokeDebitWS and InvokeCreditWS activities share the same proxy instance, but also creates a unique session ID for each transfer using the Guid class.

You should not set the SessionId property to null in both InvokeWebServiceActivity activities because this setting will generate a new Web service proxy instance for each activity and force a new session when the activities are executed.

You should not set the SessionId property to the WorkflowInstanceId property in both InvokeWebServiceActivity activities because this identifier will remain the same value for the lifespan of the workflow instance. The WorkflowInstanceId property uniquely identifies a workflow within a workflow runtime. By setting the SessionId property to the WorkflowInstanceId property's value, both the InvokeDebitWS and InvokeCreditWS activities would share the same proxy for all transfers. Also, you must convert the WorkflowInstanceId property from a Guid object to a string before setting the SessionId property.

References:

MSDN Library > .NET Development > .NET Framework 3.5 > Windows Workflow Foundation > Windows Workflow Foundation Programming Guide > Developing ASP.NET Workflow Applications > Invoking Web Services from a Workflow

MSDN Library > .NET Framework Class Library > System.Workflow.Activities Namespace > InvokeWebServiceActivity Class > InvokeWebServiceActivity Properties > SessionId Property

Objective: Create and configure custom activities.
Sub-objective: Create custom activities.

Single answer, multiple-choice

You are using version 3.5 of the Microsoft .NET Framework. You are creating a simple workflow activity to write messages to a custom event log. The activity should allow developers to specify an event source, log and entry message in the Properties window. The custom activity should require the least amount of developer effort. What should you do?

A.    Create a class derived from the SequenceActivity class.
Create class instances of DependencyProperty class for the event source, log and entry message.
Create a property for each DependencyProperty instance.
Override the Execute method to write to the custom event log.
B.    Create a class derived from the Activity class.
Create class instances of DependencyProperty class for the event source, log and entry message.
Create a property for each DependencyProperty instance.
Override the Execute method to write to the custom event log.
C.    Create a class derived from the SequenceActivity class.
Create public properties for the event source, log and entry message.
Override the OnStatusChanged method to write to the custom event log.
D.    Create a class derived from the Activity class.
Create class instances of DependencyProperty for the event source, log and entry message.
Create a property for each DependencyProperty instance.
Override the OnStatusChanged method to write to the custom event log.

Answer:
B

Tutorial:
To create a simple workflow activity with the least amount developer effort, you should create a class derived from the Activity class, add class instances of the DependencyProperty class for each property in the Properties window, add a property for each DependencyProperty instance and override the Execute method to perform its work. This is illustrated for this scenario below:

public class EventLogActivity : Activity {
     public static DependencyProperty SourceProperty =
       DependencyProperty.Register( "Source", typeof( String ), typeof( EventLogActivity ) );
     public static DependencyProperty LogProperty =
       DependencyProperty.Register( "Log", typeof( String ), typeof( EventLogActivity ) );
     public static DependencyProperty EntryProperty =
       DependencyProperty.Register( "Entry", typeof( String ),
       typeof( EventLogActivity ) );

     [Browsable(true)]
     [Category("Activity")]
     public string Source {
          get { return (string) base.GetValue( EventLogActivity.SourceProperty ); }
          set { base.SetValue( EventLogActivity.SourceProperty, value ); }
     }

     [Browsable(true)]
     [Category("Activity")]
     public string Log {
          get { return (string) base.GetValue( EventLogActivity.LogProperty ); }
          set { base.SetValue( EventLogActivity.LogProperty, value ); }
     }

     [Browsable( true )]
     [Category( "Activity" )]
     public string Entry {
          get { return (string) base.GetValue( EventLogActivity.EntryProperty ); }
          set { base.SetValue( EventLogActivity.EntryProperty, value ); }
     }
     protected override ActivityExecutionStatus Execute ( ActivityExecutionContext executionContext ) {
          if ( !EventLog.SourceExists( this.Source ) )
               EventLog.CreateEventSource( this.Source, this.Log );
               EventLog log = new EventLog( this.Log );
               log.Source = this.Source;
               log.WriteEntry( this.Entry );
               log.Close();
               return ActivityExecutionStatus.Closed;
     }
}

1 | 2 | 3 | 4 |
Viewed 9406 times.
SPONSORED LINKS
gps systems used