I’m trying to teach Ninject some new tricks by introducing it to the
So far I’ve got a config DSL in a working state and now I’m looking at
making it work with types implemented in a DLR language.
I’ve only looked at this part as a concept. In an ideal case you would
able to just inject a dynamic type by its class or module name. I don’t
know how far the C# 4 dynamic keyword will take me.
In my ideal case the compiler will start complaining because none of the
methods exist at compile-time. Is there a way for me to suss the
so that it doesn’t care whether or not its an existing method in C# 3.
it isn’t possible, and I realise that I want to sideline the compiler
Failing that there are several other approaches that I can take to do
it work none of which come close to my ideal case.
I can create a dynamic object container where I can call methods through
string, or I can just treat dynamic objects as if they were dictionaries
that group methods.
Or the user of Ninject needs to define an interface and make the dynamic
object implement that interface. That way you keep compile time checking
the compiler will actually be happy without having to hack it too much.
downside is that you would again have to do a small amount of work in
On the other hand if you’re using Ninject you’re probably already using
statically compiled language.