Some months ago I wrote SolrNet, an interface to Solr, mainly because I thought SolrSharp (the standard Solr interface for .net) was too verbose and IoC-unfriendly. I still think that way, but I always wondered what it would take to integrate it to Windsor (or any other IoC container, for that matter).
And the answer is... 241 lines of code (as per "wc -l *.cs"). That's it. That's all it took to write some interfaces and adapters and then wrap them in a Castle facility. That should teach me to try a bit harder next time! :-)
SolrNet was designed with IoC in mind, so integration is just a matter of registering a component:
<component id="solr" service="SolrNet.ISolrOperations`1, SolrNet" type="SolrNet.SolrServer`1, SolrNet">
<parameters>
<serverURL>http://localhost:8983/solr</serverURL>
</parameters>
</component>
Code is here. Note that it's just a proof of concept, I barely tested it!
1 comment:
Wow, this looks great. Excellent job putting this wrapper together. And 241 lines of code! Rock on.
Post a Comment