E.Krishna Kumar’s Weblog

Saturday, April 8, 2006

ASP.NET and Workflows

Filed under: NetFx3 — E.Krishna Kumar @ 11:05 am

Last week i got my first hands on experience of working on an exciting new technology called Windows Workflow Foundation which ships with the WinFX package. The best part is you have WWF add-ins for VS2005 for designing your workflow. For someone who has no prior experience of using Biztalk, the concept of visually designed workflows is hard to sink in. But when you start of on a new technology you are bound to face some initial hurdles. I would like to highlight one of the major ones here.
I created a workflow runtime object using the new operator and the WorkflowRuntime class constructor, like so:

WorkflowRuntime wr = new WorkflowRuntime();

Using this code in ASP.NET is fine as long as you place it in Application_Start and then find a way to make the object that is created reachable from within your page code. Instantiating the workflow runtime for each request results in an exception because the workflow runtime cannot be loaded more than once in the same AppDomain. Two ASP.NET requests have distinct state and context, but run in the same AppDomain. As a result, the first request works while the second throws an exception.

Windows Workflow Foundation provides a built-in infrastructure to guarantee that there's exactly one workflow runtime object per AppDomain and that you don't have to worry about its creation and instantiation. In ASP.NET, in fact, you can use the WorkflowWebRequestContext class to access the current and correct instance of the workflow runtime. This code shows how to get a reference to the workflow runtime:

WorkflowRuntime wr =
WorkflowWebRequestContext.Current
.WorkflowRuntime;

Internally, the get accessor of the Current property calls into a public member of a static class that caches the workflow runtime instance, creating a new instance if one cannot be found. Once you've got a reference to the runtime object, you can register the handler for the WorkflowCompleted event and start the actual workflow. This code shows how:

wr.WorkflowCompleted +=
new EventHandler<WorkflowCompletedEventArgs>(LoginCompleted);
Type t = typeof(Samples.LoginWorkflow);
WorkflowInstance instance = wr.CreateWorkflow(t, parameters);
instance.Start();

More…

Sunday, April 2, 2006

Streamlining Regulated Document Management Using the Microsoft Office System

Filed under: WSS — E.Krishna Kumar @ 8:58 pm

To comply with an ever-increasing number of regulations governing electronic data, the life sciences industry must maintain strict controls over the way this data is managed and tracked. But these same controls can also impede workflow speed and efficiency. The Microsoft Office System provides the tools and flexibility needed for efficient document management without compromising the security needed for compliance. More…

Handling WSS Document Library Events

Filed under: WSS — E.Krishna Kumar @ 8:39 pm

Microsoft Windows SharePoint Services 2.0 provides document library events that enable developers to build upon the SharePoint platform. Developers can create managed code assemblies that define handlers for these events and then bind the handlers to document libraries. The event handlers can call into the SharePoint object model to access the configuration and content databases directly, or they can invoke external services, using Windows SharePoint Services as a user interface for other systems. More…

Native Image Generator (Ngen.exe)

Filed under: .Net — E.Krishna Kumar @ 11:14 am

The Native Image Generator creates a native image from a managed assembly and installs it into the native image cache on the local computer. The native image cache is a reserved area of the global assembly cache. Once you create a native image for an assembly, the runtime automatically uses that native image each time it runs the assembly. You do not have to perform any additional procedures to cause the runtime to use a native image. Running Ngen.exe on an assembly allows the assembly to load and execute faster, because it restores code and data structures from the native image cache rather than generating them dynamically. More…

Practical Tips For Boosting The Performance Of Windows Forms Apps

Filed under: .Net — E.Krishna Kumar @ 10:58 am

The twelve performance tips given below provides you with a grab bag of ways to optimize application performance. All of them provide you with definite performance advantages, used both individually or together. Now you should be well-equipped with skills that will allow you to write fast and efficient Windows Forms applications that will impress your users and keep them happy while using your applications.


* Load fewer modules at startup
* Precompile assemblies using NGen
* Place strong-named assemblies in the GAC
* Avoid base address collisions
* Avoid blocking on the UI thread
* Perform lazy processing
* Populate controls more quickly
* Exercise more control over data binding
* Reduce repainting
* Use double buffering
* Manage memory usage
* Use reflection wisely


Read the Article: Click Here

Older Posts »

Blog at WordPress.com.