Chain.NET(a.k.a. NChain)

Overview
News
Release notes
License
Architecture
API documentation
Five minutes tutorial (VB)
Five minutes tutorial (C#)
Examples
Code repository
Download
Forums
Mailing list
Feature request
Bugs reporting
 
SourceForge.net Logo

Examples

Below examples can be found in CVS code repository or in release package.

RequestsHandler

Naive example of Chain.NET library usage for requests handling.



RuntimeInstantiation

This example shows how to instantiate concrete chain during runtime using Spring.NET and chain definition stored in XML file.

<?xml version="1.0" encoding="utf-8" ?>
<objects xmlns="http://www.springframework.net">
 <description>Example chains definitions.</description>
 
 <object id="sampleChain" type="NChain.ChainBase, NChain" >
 
  <constructor-arg name="commands">
   <list>
   
    <object name="commandOne"
      type="RuntimeInstantiation.App.SampleCommand, RuntimeInstantiation.App" >
     
     <property name="Parameter" 
         value="sample value of command parameter (sampleChain)" />
         
    </object>
    
   </list>
  </constructor-arg>

 </object> 
 
 <object id="otherChain" type="NChain.ChainBase, NChain" >
 
  <constructor-arg name="commands">
   <list>
   
    <object name="commandOne"
      type="RuntimeInstantiation.App.SampleCommand, RuntimeInstantiation.App" >
     
     <property name="Parameter" 
         value="sample value of command parameter (otherChain)" />
         
    </object>
    
    <object name="commandTwo"
      type="RuntimeInstantiation.App.SampleCommand, RuntimeInstantiation.App" >
     
     <property name="Parameter" 
         value="yet another sample value of command parameter (otherChain)" />
         
    </object>
    
   </list>
  </constructor-arg>

 </object> 
      
</objects>



Dictionary

Simple dictionary that can explain some words. Each word in the dictionary is implemented as particular command which execution logic returns word explanation via request context (when it decides that it should explain word that was passed to the dictionary via request context)



Calculator

Basic calculator which allows to perform mathematical operations.
Each mathematical operation is implemented as separate command which executes operation logic.
Architecture of such solution is very flexible and easy to extend. In case there is a need of some new mathematical operation support, appropraite command which will perform that new operation should be added to existing calculator's operations chain (chain of commands).







 
Copyright © 2007-2008 Pawel Stasiak