Zetbox.API.AutofacExtensions.RegisterZetboxImplementors C# (CSharp) Method

RegisterZetboxImplementors() public static method

public static RegisterZetboxImplementors ( this builder, Assembly source ) : void
builder this
source System.Reflection.Assembly
return void
        public static void RegisterZetboxImplementors(this ContainerBuilder builder, Assembly source)
        {
            if (builder == null) { throw new ArgumentNullException("builder"); }
            if (source == null) { throw new ArgumentNullException("source"); }

            // Register all non static ActionClasses
            foreach (var t in source.GetTypes()
                                    .Where(t => !t.IsStatic()
                                        && t.GetCustomAttributes(typeof(Implementor), false).Length > 0))
            {
                builder
                    .RegisterType(t)
                    .SingleInstance();
            }

            builder
                .Register<ImplementorAssembly>(c => new ImplementorAssembly(source))
                .AsSelf();
        }