Recoil 1.1.0 released!
NEWSFLASH! Recoil 1.1.2 is the latest version clikety click.
That’s right, after some two weeks of testing, meditation and refactoring, Recoil can be considered stable for wide adoption. Most of the changes since 1.0.0 are bug fixes when wiring nested object definitions, but that is definitely not all. All public API is now fully documented and mainly the property wiring mechanism has been unified to be less confusing.
You can grab the latest version right here. A getting started guide and some examples can be found here.
Now that Recoil is stable and the basic functionality is there, the idea is to start adding all the goodies. Right now we have the following on the list:
- Fluent proxy/advice configuration
- Non-generic interfaces for programmatic configuration
- Fluent interface for exporting web services
- Convention instead of configuration features
“But wait Tom, what the hell is this whole Recoil malarkey? I’m so confused that questionmarks are pouring out of my ears!”
Ah well…
What is Recoil?
Recoil is a fluent interface extension for Spring.NET. It provides an easy to use framework to define your object wirings in code, so they can be checked at compile time and you can continue to leverage the power of refactoring tools such as Resharper (which are reduced quite significantly when you have to manually rewire/rename objects in XML).
Recoil allows you to turn this:
<object id="MyAssembly.MyNamespace.IBar" type="MyAssembly.MyNamespace.BarFactory, MyAssembly" factory-method="Create"> <property name="TestProperty" value="TestValue"/> <property name="ListProperty"> <list element-type="MyAssembly.MyNamespace.Foo"> <object type="MyAssembly.MyNamespace.Foo> <constructor-arg name="Name" value="A Foo" /> </object> <ref object="SpecialFoo"/> </list> <property/> </object>
Into this:
Define(() => BarFactory.Create()) .As<IBar>() .Set(b => b.TestProperty).To(() => "TestValue") .Set(b => b.ListProperty).To(() => new List { new Foo("A Foo), Wire<IFoo>("SpecialFoo") });
The in-code object definition can be compile time checked, allows the developer to make full use of intellisense and refactoring tools and is easier to navigate as well (less text). I’ve actually hidden a typo in the XML object definition, see how easily you can spot it. If you manage under 15 seconds, congratulations, you must have been staring at XML way too much in your life. The ability to mentally validate xml will surely make you stand apart from the rest of the crowd though.
“But why extend Spring.NET, there are many IoC containers with fluent interfaces, and they are all free, cool and in.”
Because Spring.NET has a vast array of tools to make enterprise software development smoother and easier. While there are many frameworks which provide a subset of Spring.NET’s functionality, to this day it remains one of the most comprehensive frameworks for .NET. The only fad that was still missing is a fluent interface, and since I was tooling around with Expressions anyway (which are a core part of Recoil), I decided to take the dive and create Recoil. The final objective is to integrate Recoil into the Spring.NET framework itself, so that everyone can use the fluent interface straight out of the box!
Happy wiring!
i know the question was probably rhetorical but i did spot the instead of … in less than 15 seconds too.
I feel sad for myself. i have definitely spent too much time working with XML!!
Fatal
October 12, 2009
Ha! It is definitely a skill worthy to be included on your CV 🙂
xeophist
October 13, 2009
Excellent. How could this work with wiring asp.net pages?
Aeden
October 13, 2009
Because asp.net page/module/handler injection works slightly differently than vanilla object wiring, it is not entirely supported yet (albeit module/handler injection can work fine when one tools around a bit).
This can be one of the future features added as a kind of extension module to the core Recoil component. It is nothing hard from a technical perspective, it just has to fit in nicely with the rest of the infrastructure. Currently my idea is to add a WebWiringContainer (inherits from WiringContainer) that has all sorts of fluent web wiring capabilities (e.g. web service export/import, page injection etc..)
xeophist
October 14, 2009
Can i use config placeholders in fluent interface? For example “${SomeValueFromAppConfig}”.
admax
October 15, 2009
That is an interesting question, in the sense that I don’t know ಠ_ಠ.
You can certainly try and I think it could work provided Spring wires up config placeholders during the container refresh.
xeophist
October 16, 2009
This should be easy to fix: ObjectDefinitionRegistryConfigurer should be simply called before PropertyPlaceholderConfigurer (which handles placeholders). To make it possible you need to implement IOrdered in ObjectDefinitionRegistryConfigurer and set Order property to any value less than int.MaxValue. That’s it 🙂
maxnk
October 20, 2009
Thanks for the suggestion max, I actually looked into that option but it was not immediately apparent what should I use for the Order value and then it kind of got off the table. I’ll patch that tonight at home though because it sounds like a very simple fix.
xeophist
October 20, 2009
Can I use Spring.NET 1.3 RC1 with Recoil?
Harley Pascua
October 22, 2009
Sure. It is not built against any particular version. I use the 1.3.0 RC1 libraries myself for testing (they are not checked into the Recoil libraries repository yet though).
xeophist
October 22, 2009
I see.. coz I was getting this nasty exception:
Could not load file or assembly ‘Spring.Core, Version=1.2.0.20313, Culture=neutral, PublicKeyToken=65e474d141e25e07’ or one of its dependencies. The located assembly’s manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Couldn’t find out why though. I think I will try again in a while. Thanks for your help!
Harley Pascua
October 22, 2009
Are you using Recoil 1.1.2?
xeophist
October 22, 2009
Got it to work now. I re-built the src using Spring.NET 1.3 RC1 binaries.
Great stuff you got here!
Harley Pascua
October 23, 2009
Great, I’m glad you managed to get it to work! It is most bizarre though that you needed to rebuild because I specifically set the project to not bind to a specific version of Spring.NET.
I’ll have to look into the issue.
xeophist
October 23, 2009
[…] configuration via a fluent interface. Perhaps no more xml in the future. Read all about it on the author’s website and on the Spring.NET […]
Fluent Spring.NET configuration with Recoil « Benny Michielsen
March 25, 2010
[…] взят из поста Recoil 1.1.0 released! Комментировать ссылка Ответил admax 274 дн., 19 час., 16 […]
Fluent синтаксис для Spring.NET - CodeHelper
July 16, 2010
This is such a really difficult code which you share everyone want to us and also its very help full for me and other people which is here and here is also a site which helping to you so click this link Applanet APK
durkpolish
May 1, 2020