Has anyone started a project to do IOC at compile time (possibly using Roslyn or Linq MethodInfo emit)?
My experience with IOC containers has thus far been great, baring a few small issues
- Many IOC containers are slow to start up, as much of the resolution logic occurs here
- It is often hard to ensure that resolution is possible, as compilation no longer ensures that the constructor can be called
- Often IOC containers add a small overhead to the runtime (some aren't even small, often the ones that start up quickly run slowly)
It seems to me that the ideal solution would be to add a compile step to the build chain that adds a Factory class instead of IOC.
Has anyone done this before? If not, why not?