IOC for MVC apps

83 views
Skip to first unread message

Marlon Grech

unread,
Sep 16, 2014, 6:32:32 AM9/16/14
to wpf-disciples
Hey guys,

I am building an MVC + WebAPI and was wondering what you guys prefer as an IOC these days. I am currently using MEF but I have to hack around to make sure there are no leaks. Anyone can suggest anything ? 


Regards


Marlon Grech

Founder

Thynk Software, BellaVista Court,
Gorg Borg Oliver Street,
Gozo, Malta, VCT 2517

M 00356 7971 0723
E mgr...@thynksoftware.com
W www.thynksoftware.com
B marlongrech.wordpress.com

Sacha Barber

unread,
Sep 16, 2014, 6:43:16 AM9/16/14
to wpf-di...@googlegroups.com

Autofac is very good, though castle has nice perrequest, perwcfrequest lifetime managers (autocracy had per web request too). Though in castle you MUST register everything, it has nice fluent so I. Things like unity/autofac have better support for child containers. And autofacs disposal pattern is well thought out, and it also supports metadata like mef (Nick who wrote part of mef wrote it, which explains that)

So yeah autofac I would say

--

---
You received this message because you are subscribed to the Google Groups "XAML Disciples" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wpf-disciple...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

karl shifflett

unread,
Sep 16, 2014, 8:10:57 AM9/16/14
to wpf-di...@googlegroups.com
Have always used Unity. 

Sent from my iPad

Sacha Barber

unread,
Sep 16, 2014, 8:40:32 AM9/16/14
to wpf-di...@googlegroups.com

Yeah Unity is not so bad to be honest

Michael Sync

unread,
Sep 16, 2014, 8:47:34 AM9/16/14
to WPF Disciples
I think Autofac  is pretty good for MVC + Web Api.. I think there is some comparsions about ease to use and speed.. Autofac is in the top .. I used to be very active in Unity, Unity port for Phone, Contrib but I prefer Autofac  now.. :) 

Thanks and Best Regards,
Michael Sync

Don't go the way life takes you.
Take life the way you go

http://michaelsync.net

Daniel Vaughan

unread,
Sep 16, 2014, 8:47:03 PM9/16/14
to wpf-di...@googlegroups.com

I use Calcium’s. It does DI with support for circular references. I started writing an adapter for Autofac then realised it has this “okay, everything’s done” Build() method. When you want to register new types and so forth you have to use some extension methods and rebuild. I found that awkward. Apart from that, it seems alright.

I've also come to detest fluent APIs apart from well understood domains, like SQL. But that’s just me. I can’t think of anything else I’d want to use a fluent API for apart from an SQL related scenario.

If you’re using Web API then, from memory, Autofac comes already wired up. So there’s nothing to do. That’s nice.

Calcium doesn't support child containers yet. That’s something I should do, but I just haven’t needed it.

I also used Unity for a long while. I believe, for web stuff, the key is performance. It would be wise, I’d say, to take a look at some perf comparisons.

Anyway, that’s my take.

Cheers,

Daniel

Marlon Grech

unread,
Sep 19, 2014, 4:24:40 AM9/19/14
to wpf-disciples
thanks for all the feedback.... I think I will end up going for Unity (even though I do not like it much) yet I have used it successfully in the past for large scale projects 


Regards


Marlon Grech

Founder

Thynk Software, BellaVista Court,
Gorg Borg Oliver Street,
Gozo, Malta, VCT 2517

M 00356 7971 0723
E mgr...@thynksoftware.com
W www.thynksoftware.com
B marlongrech.wordpress.com

Sacha Barber

unread,
Sep 19, 2014, 6:46:41 AM9/19/14
to wpf-di...@googlegroups.com
Ah Unity is ok, you just need to write loads of extension methods (in my opinion) to neaten up the registration process
Sacha Barber
sacha....@gmail.com

Peter O'Hanlon

unread,
Sep 19, 2014, 6:47:30 AM9/19/14
to WPF Disciples
Loads and loads and loads of extension methods.
Peter O'Hanlon

Karl Shifflett

unread,
Sep 19, 2014, 8:55:49 AM9/19/14
to wpf-di...@googlegroups.com
I use an attribute on my concrete classes that auto registers them.  Never wrote any extensions methods.


Sacha Barber

unread,
Sep 19, 2014, 9:17:59 AM9/19/14
to wpf-di...@googlegroups.com
Seems I am not alone
Reply all
Reply to author
Forward
0 new messages