Is Autofac magical – part II

Now that you’ve read part I perhaps you can answer this. What does this code do?     class FO : IEnumerable    {         public IEnumerator GetEnumerator()        {            throw new NotImplementedException();        }    }     class Program    {        static void Main(string[] args)        {            var cb = new ContainerBuilder();            cb.Register(ctx => new FO()).As<IEnumerable>().InstancePerLifetimeScope();            cb.Register<Func<FO>>(ctx => { return ()…

0

Is Autofac magical?

The answer is yes! OK let me explain. I never registered anything as Func<IObservable<object>> and yet the below code still works. It turns out to be that not only does autofac understand Func<Dependency>(), it understands a whole bunch of things that you may or may not have intended to be dependency relationships. 🙂 The details…

0

Distilling some ideas for keeping that data access code (and test code) tidy…

I just spent a while doing some refactoring. It turned out to be a very long while, probably much more than I would have originally estimated. (Part of the reason for that is builds and tests that take a long time…) The changes I made were somewhat haphazard at first, and I wasn’t sure why I thought…

0