Zetetic.Chain - Some love for .NET

2009-05-13 20:00:00 -0400


Today we released Zetetic.Chain on github as open source under a BSD-style license. The inspiration for Zetetic.Chain is Apache Chain, but Zetetic.Chain also takes advantage of some of the things .NET does really well without lots of dependencies, like reflection attributes (well, reflection in general), XML serialization, Remoting, indexer properties, and so on.

The Chain concept lets you work with commands, and stacks of commands, with a simple model—just say the name of the command you want to run, pass it an object in which to get and set state / results, and the Zetetic.Chain library takes care of the rest, keeping your implementation nice and clean. You configure the details of each command in a lean n’ mean XML file. Example:


<catalog>
<chain name="TellStory">
<command name="first" typeName="Storybook.WalkInTheWoods">
<add key="BoysName" value="Hansel" />
<add key="GirlsName" value="Gretel" />
</command>
<command name="also" typeName="Storybook.BirdsEatTheBreadcrumbs" />
<command name="ohno" typeName="Storybook.WitchInCandyHouse" />
</chain>
</catalog>

Your code can fire off the chain of events simply by calling:


ICatalog catalog = CatalogFactory.GetFactory().GetCatalog("storybook.xml");
IContext context = new ContextBase();
catalog["TellStory"].Execute(context);

So check it out, let us know what you think! Personally I know this library is going to become part of most of my ongoing projects on the .NET platform.