Problems with Unity and PostSolrConnection

147 views
Skip to first unread message

Markus Engelhardt

unread,
Apr 17, 2014, 7:15:50 AM4/17/14
to sol...@googlegroups.com
Hi there.

I try to change the registration for ISolrConnection to PostSolrConnection.
I work with unity.
When I debug, the container has the correct registration.

The problem occurs when I execute queries as when I look at  ISolrBasicOperations<T> it still has the original registered implementation in
its member declaration, and I really do not see at present what I am doing wrong...

I definitely retrieve my ISolrOperations<T> from the same Unity container instance in which I updated the ISolrConnection,
but it seems as if the contained ISolrBasicOperations<T> member has been initialised before the update.

Any clues anybody?

thanks a lot (again),

Markus

Mauricio Scheffer

unread,
Apr 21, 2014, 4:41:11 PM4/21/14
to sol...@googlegroups.com
I'm not familiar with Unity, and the original author of the Unity integration doesn't seem to be around, but my guess is that ISolrConnection/SolrConnection is being bound by name ( see https://github.com/mausch/SolrNet/blob/master/Unity.SolrNetIntegration/SolrNetContainerConfiguration.cs#L79 ) and that's why you can't register your decorator.

As I said before in https://groups.google.com/d/msg/solrnet/jrzyxWHnIkE/RWjxBYk4GRkJ I recommend getting rid of your IoC container. Compose the objects however you need them. Not just for SolrNet, but for all programming. IoC containers are just not worth the complexity and magic they introduce.



--
Mauricio


--
You received this message because you are subscribed to the Google Groups "SolrNet" group.
To unsubscribe from this group and stop receiving emails from it, send an email to solrnet+u...@googlegroups.com.
To post to this group, send email to sol...@googlegroups.com.
Visit this group at http://groups.google.com/group/solrnet.
For more options, visit https://groups.google.com/d/optout.

Markus Engelhardt

unread,
Apr 23, 2014, 7:37:37 AM4/23/14
to sol...@googlegroups.com
Maybe I just found something...

For any reason that I do not get so far, in the class
SolrNetContainerConfiguration

in the method 
AddCoresFromConfig

Each and every core is registered again, every time a new container is set up.
So I set up my container with the new connection for logging,
and afterwards I add another core with the "normal" connection, 
which then always overwrites the old ones.

The really weird part for me at present is, that I had already set up my own mapping collection, 
in which I put an own SolrServers instance for each document type I have and each of these has its own unity container instance;
which I did exactly with the intention to prevent anything like that.

So I really do not have a clue, how this possibly could have overwritten my registrations in the other containers,
but after I put the registration of the other cores BEFORE the updated of SolrConnection, it suddenly worked...


Reply all
Reply to author
Forward
0 new messages