I just started downloading the vista RTM of the msdn website
Category Archives: .NET 3.0 - Page 2
Vista is available on MSDN
Boo, Ironpython, Scriptaculous, MS Ajax and me
Over the weekend I got the idea of learning ironpython by moving the codebase that I have for nblogr to ironpython script and compiling it.
Everything went fine until I had to decorate a method to make it cache/participate in a transaction/set a layout on a controller because ironpython in all its beauty doesn’t support attributes on methods or classes.
I’m also missing a reference for ironpython. Something that shows the available functions and the syntax for inheritance etc. which slowed me down of course.
Why do I want a dynamic language ?
The 2 main reasons are : Duck typing and readable anonymous functions. In c# there is the concept of anonymous delegates but that code really looks like it has been hit by a train, ugly.
I’ve been writing in boo for a while now just as a templating language and yes I like boo a lot. It combines the nice features of python with the c# language in a wrist friendly way. (I never got the point of wrist friendly thing until I got carpal tunnel syndrome, now it suddenly is a major issue)
I sure wish there would be a language service for visual studio to do boo development but I’ve been using sharp develop 2.1 to check it out.
SharpDevelop 2.1 is a nice piece of work definitely for an open source IDE’, it beats eclipse in my book
In boo everything is an object also your functions and expressions (read it has anonymous functions). Boo is strong typed but mimics duck typing in some form.
To conclude this little intermezzo : my next project will be written in boo
On the ajax library front I would have to report that I haven ‘t looked at atlas/ms ajax since the beginning of september . I had decided to use it again when they finally release the framework. So I’ve been checking out these other libraries that are out there. I checked out jquery which is a cool library but it is also slower in execution than the other ones.
The next one on the list was scriptaculous and that is the one I’ve been using in my projects now. Scriptaculous does exactly what is expected and uses the javascript prototype model which happens to be one i like
The move from the guys at MS to make their ajax extensions based on prototype was surprising but very positive in my book
So when they release it i’ll look at creating an javascript provider for nblogr so that you would be able to switch between your favourite library (we have plans to support the major libraries out of the box.)
Castle and workflow foundation
Yesterday I had to implement workflow in an application. I had never used it before, and kind of feared that it was going to take me a couple of days to get the hang of it.
Well 2 hours later I had my test workflow going so it isn’t hard at all. If I can do it in that amount of time I’m sure many of you can beat me.
Now I wanted to host the workflow runtime in my container and this is how I went about it:
I made 2 wrapper properties in a settings class :
public static class SeshatAppSettings
{
public static WorkflowRuntime WorkflowRuntime
{
get
{
return HttpContext.Current.Application["WorkflowRuntime"] as WorkflowRuntime;
}
set
{
HttpContext.Current.Application["WorkflowRuntime"] = value;
}
}
public static ManualWorkflowSchedulerService WorkflowScheduler
{
get
{
return WorkflowRuntime.GetService(typeof(ManualWorkflowSchedulerService)) as ManualWorkflowSchedulerService;
}
}
}
The next thing that comes to mind is, hey I need to start this when my application starts (start, app starts == IStartable). Because the workflow is hosted in asp.net we need a persistence medium. I chose to stay with the standard workflow foundation sql persistence service. And that implementation goes a bit like this :
public class WorkflowHost : IStartable
{
#region IStartable Members
///
/// Starts this instance.
///
public void Start()
{
// Create an instance of the workflowRuntime
WorkflowRuntime workflowRuntime = new WorkflowRuntime();
// Add a manual scheduling service
ManualWorkflowSchedulerService manualService = new ManualWorkflowSchedulerService();
workflowRuntime.AddService(manualService);
// Add our persistence
AddPersistenceService(workflowRuntime);
// Start the workflow runtime
workflowRuntime.StartRuntime();
// Store it in a place so that the whole application can get to it.
SeshatAppSettings.WorkflowRuntime = workflowRuntime;
}
///
/// Stops this instance.
///
public void Stop()
{
WorkflowRuntime workflowRuntime = SeshatAppSettings.WorkflowRuntime;
workflowRuntime.StopRuntime();
}
#endregion
private void AddPersistenceService(WorkflowRuntime runtime)
{
// Create the SqlWorkflowPersistenceService.
string connectionString = “Initial Catalog=WorkflowPersistenceStore;Data Source=localhost;Integrated Security=SSPI;”;
bool unloadOnIdle = true;
TimeSpan instanceOwnershipDuration = TimeSpan.MaxValue;
TimeSpan loadingInterval = new TimeSpan(0, 2, 0);
SqlWorkflowPersistenceService persistService = new SqlWorkflowPersistenceService(connectionString, unloadOnIdle, instanceOwnershipDuration, loadingInterval);
// Add the SqlWorkflowPersistenceService to the runtime engine.
runtime.AddService( persistService );
}
}
The last bit we need to take care of is adding our startable component to the container which is pretty easy to do.
public class WorkflowFacility : AbstractFacility
{
protected override void Init()
{
Kernel.AddComponent(“workflow.defaultHost”, typeof(IStartable), typeof(WorkflowHost));
}
}
And the final piece is the configuration from the component