CodeProject - BarbarianIOC : A simple IOC Container
- Introduction
- What Does It Do
- How Does It Work
- That's It
Introduction
...
Thing is I have always wanted to try and make one of these myself, just to see what is involved. I did not want to go too nuts on this, and just wanted the following really:
- Instance configuration : singleton / transient
- Simple registration process, maybe some sort of fluent interface
- Use the Expression API to compile into delegates for quick creation of objects
- Constructor / property injection
- Provide the ability to accept non IOC held constructor parameters
So those couple of points are ALL I wanted to get working. As I say there are a whole slew of full fledged IOC containers out there (where I have named a few above), this articles container is more of a learning exercise, that I thought I would share, in case anyone else is interested in this sort of thing.
I am calling my container
BarbarianIOC
as the existing containers all seems to have these short snappy names, and it's kind of play on my name, and if you saw me without a shave I do kinda look a bit like a barbarian.So there we go. That's essentially what this article is about, but just before we get into the guts of it, please read this important note below.
IMPORTANT NOTE
I should point out that you should stick to using one of the major IOC containers out there, as this was an exercise to see what you needed to do to create your own. That is not to say I am not happy with it, I totally am, and I think with more tinkering, I could make it act near enough like one of the "proper" IOC containers out there, but I just know that, that tinkering will never happen, as I am always eager to move on to something new. So yeah just stick to using one of the big "proper" IOC containers out there.
What Does It Do
In this section I will should you how to use
BarbarianIOC
, and what that looks like in a typical application..."
Mare than anything I just like this Project's name... I've been meaning to jump into some real world IOC ("What? Greg, you're not IOC'ing every day in every app? ZOMG!" Yeah, yeah, I know... but my brain is only so big and I'm still trying was out the VB6'ness... sigh.. GC.Collect... GC.Collect.... ;)
Anyway, I like Sacha's past work and have learned a good bit from reading his articles, so this one looks like it's going to my "Must grok soon" list.
No comments:
Post a Comment
NOTE: Anonymous Commenting has been turned off for a while... The comment spammers are just killing me...
ALL comments are moderated. I will review every comment before it will appear on the blog.
Your comment WILL NOT APPEAR UNTIL I approve it. This may take some hours...
I reserve, and will use, the right to not approve ANY comment for ANY reason. I will not usually, but if it's off topic, spam (or even close to spam-like), inflammatory, mean, etc, etc, well... then...
Please see my comment policy for more information if you are interested.
Thanks,
Greg
PS. I am proactively moderating comments. Your comment WILL NOT APPEAR UNTIL I approve it. This may take some hours...