Configure Masstransit 2.0.0.5 with Ninject 2.0 - ninject-2

Probably being dumb here.. but its getting late :)
I am trying to use MassTransit with Ninject. I know there isnt as much love for Ninject with MT but I want to continue regardless.. and maybe help out evntualy.
Examples I have found so far appear to require that base class MassTransitModuleBase is used from MassTransit.NinjectIntegration;
However in 2.0.0.5 this doesnt appear - has this changed? Any recommendations?

They likely are still old, pre-2.0 examples. 2.0 of MT has been updated to take containers out of the core. In fact, with 2.0 you can use it without a container to get you up and started.
The Cashier part of one of the samples, https://github.com/MassTransit/MassTransit/tree/master/src/Samples/Starbucks/Starbucks.Cashier, uses NInject. Ideally this can get you moving forward a little bit more. If not, feel free to post on the mailing list https://groups.google.com/forum/#!forum/masstransit-discuss.

Related

MVC4 Would it be wise to choose Unity as DI container just because it is from microsoft? Possible duplicate

Possible duplicate
How to choose a DI container
I believe everyone goes through this dilemma of choosing the right DI container.
I read questions regarding this here but they are kind of outdated and probably things has changed since then.
Since there are lot of developers here who currently work on MVC project, I thought it could be good idea to listen to their opinion and experience, which could be invaluable for starters like me.
In a book ASP.NET MVC4 in Action they have chosen StructureMap because of its "Powerful API and Popularity".
But then there is also Unity which is from microsoft, kind of sounds tempting because it is from Microsoft and may be it'll get powerful in future(just guessing).
I'm sure I'll get nice suggestions here.
Thanks in advance.
I think you should first get an idea of what you're looking for in the DI container and look at feature tables for different DI containers: for example https://stackoverflow.com/a/4583809/3204
The idea is to get a feeling of the features that matter to you and filter out what wouldn't match what's needed.
On a personal note, i'd recommend choosing another DI component; i have a feeling that Microsoft is really trying to cover all bases in the .net ecosystem, and ends up being a jack of all trade and ace of none; open source projects apparently end up being much more resilient to changes of focus in Microsoft attention.

Searching for a better Dependency Injection / Inversion of Control Tool. Migrating from StructureMap

Why leaving StructureMap?
As stated by Jeremy Miller (The guy behind StructureMap): No Silverlight support
Why I need Silverlight support?
I'm starting to write WindowsPhone apps, so looks like I need this.
Purpose of this question?
I love StructureMap. It's full of features and I've been using it for many of my projects. But I have to choose a new one. Which one should I choose?
AutoFac?
Ninject?
Other tools?
What I want from new framework?
Supporting Windows Phone.
Right now I'm registering my singleton dependencies using StructureMap like this:
ObjectFactory.Configure(Function(config)
config.For(Of TPlugin).Singleton.Use(Of TConcrete)())
Or this (for generic types):
ObjectFactory.Configure(Function(config)
config.For(Of GetType(IRepository(Of ))).Use(Of GetType(Repository(Of )))())
Or forwarding types:
ObjectFactory.Configure(Sub(config) config.Forward(Of TResolveBy, TRequested)())
I want to do the same things with syntax near to StructureMap(or a better syntax)
What I want from you?
Do you have any experience with them?
Which one do you prefer?
Which one do you recommend to be used in a Windows Phone App?
Any other suggestions?
Update:
What about life cycle and initializing of the concrete type(using a function instead of just defining the type)?
In StructureMap :
config.For(pluginType).Singleton.Use(concreteType)
or
config.For(Of TPlugin).HybridHttpOrThreadLocalScoped.Use(SomeFunction)
I do recommend Ninject. I use it for all my projects mainly because of its auto-binding feature, that allows you to put together interface and its implementation automatically without explicit configuration (like in your samples) - example can be found here.
And you can still use manual configuration just like in your code samples - check out Ninject documentation for examples.
It seems to support Silverlight as well, so it should be usable for you.
EDIT:
As per StriplingWarrior's comment, the way auto-binding syntax works has changed in recent version of Ninject - check out this SO question for details.
When I did some research a while back to decide what DI framework to use, I found that a lot of people seemed to favor Ninject. I've been using it ever since, and loving it. Remo Gloor has done some really great work with it and its various extensions, and we just upgraded to Ninject 3 a few days ago.
The binding syntax is pretty simple. I usually use a NinjectModule subclass and say (in C#):
Bind<TPlugin>().To<TConcrete>()
... which I believe is pretty similar to what you're doing now.
I'm using SimpleContainer that's packaged with Caliburn Micro.
IOC Battle–Revisited
Update: there is also a separate nuget package for SimpleContainer.
Who needs an IoC tool? The Factory and Abstract Factory patterns are easy, awesome, and you never have to wonder if they support technology XYZ.

is spring.net being actively maintained/developed/documented?

In the course of evaluating .net IoC frameworks, I gave spring.net a try first, seeing as how much I liked spring in java. However, I'm rapidly getting the feeling that it is a stale/stalled/dead project. The forums have almost no activity; the documentation, though verbose, is infuriating with its self-referencing, poor examples, and incomplete sections; spring.net questions don't seem to get much traction on stackoverflow; and googling for spring.net issues usually leads to pages documenting somewhat obscure scenarios. I'm close to making the jump to Ninja or Castle, but I can see that their documentation doesn't exactly sparkle either. Still, if everyone has poor documentation, I'd rather pick an active project. What are your suggestions?
Spring.NET is pretty active.
Take a look to their bug tracking system :
https://jira.springsource.org/browse/SPRNET
They have 2 full-time committers working on it.
Spring is pretty active, as pointed out by Paul. Their IoC container is excellent, in my opinion. As I write this, they're actively working on a code-config project at github .

Good learning resources for JNDI implementation (JBoss 5)

I have been working with JavaEE/EJB3 web apps for about half a year now. Until recently, I haven't had to touch a lot of the behind-the-scenes stuff, just the meat of the code. I have been wrestling with JNDI problems, and though I've solved a couple of them, I'm pretty much just doing the whole cargo cult copy-paste routine. It would really help me to better understand JNDI; my understanding of it right now can be summarized as "it's that thing these classes sometimes do to find other classes."
My question is, has anyone had success learning JNDI/EJB3/related topics from a book or online content? I've googled for it but the stuff that comes up is old or specific to a certain framework I'm not using. I'm looking for something that's either JBoss-specific or generic enough to be useful anyway.

web framework that will reduce number of lines of code

which framework helps in reducing the number of lines of code needed to create a web app?
ruby on rails?
php?
asp.net mvc?
jsp/servlet?
django/python?
I just don't like typing a lot of code especially if it's boilerplate. If I can write 10 lines of code versus 100 to get the same results, I think most people would prefer 10...right? So, tell me which web framework will acheive this goal.
All of them.
I wouldn't use "Shortest program" as a guiding factor in selecting one though.
It really depends on what backend and DB you are using to support your web app.
I mean, if you are consuming .Net web services then I think asp.net (and visual studio) would be the best match to generate all code behind classes to consume the data strongly typed. Other backend/db maybe make you choose a totally different path.
For a complex application: Seaside. None of the others comes close. Especially when you run it on a OODB like Gemstone: Glass
The answer to the question is completely circumstantial; certain frameworks will require less lines of code for specific purposes. Perhaps if you can give the StackOverflow readers an idea of the kind of task you wish to accomplish, they can point you in the direction of the framework that is most likely to accomplish the task in fewest lines of code.
SilverStripe requires almost no lines and no understanding of PHP. It comes with the UI, Auth, and everything you need to get started.
http://silverstripe.org/
http://www.slideshare.net/chillu/modeladmin-in-silverstripe-23
http://doc.silverstripe.com/doku.php?id=modeladmin
I think you can answer this question yourself with this way: Do the get started project.
In my case was: django/python, why?, see the get started project, will take a 1 or 2 hours to understand/develop/deploy, and not python knowledge required, just a hyperactive open mind.

Resources