Yep bep, you certainly can. At least I have done so much with Candidate Release Workflow 4.
Consider
I believe that endpoint configuration can be set through the standard Wcf service configuration sections in App.config. In my experiments with Workflow, I personally did not try to change the default transport level.
The above shared hosting hosting class [i.e. he is the host of WorkflowServices]. This allows us to reuse this hosting feature in the console, WinForm, WPF or yes, even in a WindowsService application. The following is a WindowsService that uses our host class
If you replayed WorkflowServices in VS2010RC, then you already know that WorkflowServices are not Xaml classes like their Workflow cousins. Instead, they are saved as free Xaml files with the extension .xamlx. For WorkflowServices [as far as I know] there is no Intellisense support for development and time, and they are not recognized as declared types, so our only options for loading WorkflowService at runtime are
- Read the clean Xaml markup directly from the .xamlx file.
- Read pure Xaml markup from another source [inline string, resource or other source]
In any case, we must interpret the markup and create a WorkflowService definition. The following converts the string [, which may be a file name or markup] to a WorkflowService. Keeners may also point out that there is a difference between this process and the process of converting Workflow markup to Workflow definitions.
// converts a string value [either pure xaml or filename] to a // WorkflowService definition public WorkflowService ToWorkflowService (string value) { WorkflowService service = null; // 1. assume value is Xaml string xaml = value; // 2. if value is file path, if (File.Exists (value)) { // 2a. read contents to xaml xaml = File.ReadAllText (value); } // 3. build service using (StringReader xamlReader = new StringReader (xaml)) { object untypedService = null; // NOTE: XamlServices, NOT ActivityXamlServices untypedService = XamlServices.Load (xamlReader); if (untypedService is WorkflowService) { service = (WorkflowService)(untypedService); } else { throw new ArgumentException ( string.Format ( "Unexpected error reading WorkflowService from " + "value [{0}] and Xaml [{1}]. Xaml does not define a " + "WorkflowService, but an instance of [{2}].", value, xaml, untypedService.GetType ())); } } return service; }
source share