Skip to main content

Which .NET Dependency Injection frameworks are worth looking into?


Which C#/.NET Dependency Injection frameworks are worth looking into? And what can you say about their complexity and speed.



Source: Tips4allCCNA FINAL EXAM

Comments

  1. I suppose I might be being a bit picky here but it's important to note DI (Dependency Injection) is a programming pattern and is facilitated by (but does not require) an IoC (Inversion of Control) Framework. IoC Frameworks just make DI much easier, but it's not only DI that they do, they provide a host of other benefits over and above DI.

    That being said, I'm sure that's what you were asking: about IoC Frameworks: I used to use Spring.Net and CastleWindsor a lot, but the real pain in the beehiind was all that pesky XML config you had to write! They're pretty much all moving this way now, but I started using StructureMap for the last year or so, and since it has moved to a fluent config using strongly typed generics and a registry, my pain barrier in using IoC has dropped below zero! I get an absolute kick out of knowing now that my IoC config is checked at compile-time (for the most part) and I have had nothing but joy with StructureMap and its speed. I won't say that the others were slow (runtime), but they were more difficult for me to setup and frustration often won the day.

    I believe they're all moving towards a more strongly typed config now - or at least providing the option, but some people love putting all the config in XML - personally I can't bare it, so I have stuck to StructureMap now.

    I can't comment much on Ninject except that I listened to Nate on one of the Herding Code podcasts and he's one switched-on guy, and the screencasts I've watched have really tempted me to try it out - maybe on the next project - who knows.

    Update: In a follow up to my comments here, I've been using Ninject (as promised) on my latest project and it has been an absolute pleasure to use. Words fail me a bit here, but (as we say in the UK) this framework is the Dogs'. I highly recommend it for any green fields projects where you want to be up and running quickly. I got all I needed from a fantastic set of Ninject screencasts by Justin Etheredge. I also can't see that retro-fitting Ninject into existing (above average) code being a problem at all - but then the same could be said of StructureMap in my experience. It'll be a tough choice going forward between those two, but I'd rather have competition than stagnation and there's a decent amount of healthy competition out there.

    Other IoC screencasts can also be found here on Dimecasts.

    Hope that helps,

    Rob G

    ReplyDelete

Post a Comment

Popular posts from this blog

Why is this Javascript much *slower* than its jQuery equivalent?

I have a HTML list of about 500 items and a "filter" box above it. I started by using jQuery to filter the list when I typed a letter (timing code added later): $('#filter').keyup( function() { var jqStart = (new Date).getTime(); var search = $(this).val().toLowerCase(); var $list = $('ul.ablist > li'); $list.each( function() { if ( $(this).text().toLowerCase().indexOf(search) === -1 ) $(this).hide(); else $(this).show(); } ); console.log('Time: ' + ((new Date).getTime() - jqStart)); } ); However, there was a couple of seconds delay after typing each letter (particularly the first letter). So I thought it may be slightly quicker if I used plain Javascript (I read recently that jQuery's each function is particularly slow). Here's my JS equivalent: document.getElementById('filter').addEventListener( 'keyup', function () { var jsStart = (new Date).getTime()...

Is it possible to have IF statement in an Echo statement in PHP

Thanks in advance. I did look at the other questions/answers that were similar and didn't find exactly what I was looking for. I'm trying to do this, am I on the right path? echo " <div id='tabs-".$match."'> <textarea id='".$match."' name='".$match."'>". if ($COLUMN_NAME === $match) { echo $FIELD_WITH_COLUMN_NAME; } else { } ."</textarea> <script type='text/javascript'> CKEDITOR.replace( '".$match."' ); </script> </div>"; I am getting the following error message in the browser: Parse error: syntax error, unexpected T_IF Please let me know if this is the right way to go about nesting an IF statement inside an echo. Thank you.