Chris Donnan : Programming – Brooklyn Style
software, trading, family, fun
Spring Framework Developer Session .Net Code Examples
Posted programming on Thursday, June 1st, 2006.
Posted programming on Thursday, June 1st, 2006.
Thanks to the ~40 folks that came out last night for our 1st developer session. The night wound up being fairly SpringFramework.net centric. I gave a quickie demo of some code I have been working on for the forthcoming SpringFramework.net Desktop Application Framework.
I also had some requests to post the .net code project I used as an example.
Spring Framework.net demo code
There are a few areas that can be looked at for example purposes.
- Start by looking in the Program.cs in the SpringPresentation project. This will show you at least the entrance into spring and the top of the object graph with the Main form.
- Look at the App.config file in the SpringPresentation project. Trace the object graph from the Main Form – to it’s presenter, to it’s commands. Notice how the commands are just added to a generic dictionary – as you add commands – you could just add them to this strongly typed (thanks to generics) dictionary.
- From there – the commands reference other prototype objects that are what I used as the center of the demo. In essence – our ‘business obejcts’ could be used in a few different ways. We vary the behavior of the business object by injecting different dependencies (strategy like classes in this case).
- The ComplexBusinessObject.cs file in the library project has a few things in it (this was for convenience in the demo). There are the basic interfaces used to do this business object thing
- interface IComplexBusinessObject
- interface IBusinessData
- interface ICalculator
- Essentially – ComplexBusinessObject implements it’s interface – IComplexBusiness object by containing strategies that do the real work. These strategies can be passed in – thus allowing you to have different configurations of the same ‘ComplexBusinessObject’. In the spring configuration – you can see that there are ‘Strict’ and ‘Easy’ (arbitrary fake names like all of this demo). These different configurations hand different implementors of the ICalculator interface to make the object do it’s work differently in different circumstances. This type of thing is a prime example of how IoC in general is valuable.
- The core idea again is that spring assembles these objects for you as needed. It can manage making all of this configurable, flexible etc.
Feel free to comment here with questions etc or email me directly.
Thanks;
Chris
No Responses to “Spring Framework Developer Session .Net Code Examples”
Comment on this post below
You must be logged in to post a comment.
You can leave a response, or trackback from your own site.








[...] It is time for the next ‘Developer Session’ in my series … The last one that we did – Spring Framework Developer Session (code, power point) was a hit – with maybe ~40 people who came out to hear about Spring. [...]
Very nice code, I tried it and it works. I have small question I wrote two user controls using the same technique as you used for the main form and then put the user controls on the main form. I get cannot resolve the mainController. I am sure the problem is in the config. Do you have an example showing two user controls on a main form.
Thanks
Dr Y Arezki
your best bet is to download the anon cvs version of the spring DAF @ springframework.net’s sourceforge site. That has the current working spring Desktop App Framework and what you are looking for.
-Chris
Do you have a link for Spring DAF, I tried and could not find it.
I downloaded it and I could not compile it. I wish somebody could provide a zipped file or an installer.
Yazid
I downloaded springDaf and when I tried to compile I get the following files are missing:
In the UIApplicationContainer, there a reference to class ControlWatcher and I cannot find it.
Similarly in IUIApplicationContext there is a reference to ViewNavigator and I cannot find it anywhere.
Could I get a copy of ViewNavigator and ControlWatcher.
TIA
Yazid