It would be nice to know a bit more about the nature/type of application that 
you are developing.  
For most of my SharePoint solutions I have not bothered with an IoC container 
but have instead, loaded service settings and connection strings directly from 
configuration and then manually injected them into something like a Presenter 
class from my WebPart code class.
So I still use DI, but I don't bother with using a separate container - I just 
use (for example) my WebPart class as the composition root in my code file.
But again, it might depend on what your solution looks like.
If you are interested I have blogged a code-centric sample of my approach:
    http://2010wave.blogspot.com/2010/02/sharepoint-architecture-part-2-mvc.html
But you might also typically use an additional "Presenter" class on top of what 
I have in that article.

Kind Regards, Darren [email protected] http://2010wave.blogspot.com  



Date: Mon, 12 Apr 2010 16:23:52 +1000
Subject: Dependency Injection recommendations for SharePoint
From: [email protected]
To: [email protected]

Hi List,



As a budding SharePoint developer, I was hoping there are some people on
 the list here who can provide some guidance and/or anecdotes on 
selecting a suitable IoC container for a custom SharePoint solution.



I started investigating this today and have become somewhat dismayed at 
how inflexible it seems to be to deploy a container inside a SharePoint 
site.



Most containers I have looked at so far (Spring.NET, Autofac, Castle 
Windsor) recommend modifying global.asax with a custom class that 
inherits from SPHttpApplication.  Because our SharePoint Solution may be
 deployed within arbritary SharePoint sites by the customer(s), am I 
correct in assuming that this approach would make our product 
incompatible with a customer's own potential global modifications?



An alternative I have read for Autofac is to insert Autofac's custom 
HttpModules that control the container setup and tear down into the 
request pipeline into the SharePoint site via web.config.  I have not 
fiddled with the SharePoint web.config before but seem to recall reading
 blog posts that discourage it because you either have to hack it during
 your solution deployment, which won't work in 100% of deployment 
scenarios, or use SPConfigModification, which has a gross API.



I'm at the point now where I am considering rolling my own extremely 
simple container just so I don't have to deal with the deployment 
minefield.



Does anyone have some experiences to share which might help enlighten 
me? :)



Cheers,

Joe.


                                          
_________________________________________________________________
The New Busy think 9 to 5 is a cute idea. Combine multiple calendars with 
Hotmail. 
http://www.windowslive.com/campaign/thenewbusy?tile=multicalendar&ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_5
_______________________________________________
ozmoss mailing list
[email protected]
http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss

Reply via email to