Example #1
0
        public static IContainer Register()
        {
            var builder = new ContainerBuilder();

            builder.AddApplicationDI();
            Container = builder.Build(Autofac.Builder.ContainerBuildOptions.None);
            return(Container);
        }
Example #2
0
        public static IContainer Register()
        {
            var builder = new ContainerBuilder();

            builder.AddApplicationDI();


            builder.RegisterType <AutoMapperProfiles>().As <Profile>();
            builder.Register(c => new MapperConfiguration(cfg =>
            {
                foreach (var profile in c.Resolve <IEnumerable <Profile> >())
                {
                    cfg.AddProfile(profile);
                }
            })).AsSelf().SingleInstance();
            builder.Register(c => c.Resolve <MapperConfiguration>().CreateMapper(c.Resolve)).As <IMapper>().InstancePerLifetimeScope();

            Container = builder.Build(Autofac.Builder.ContainerBuildOptions.None);
            return(Container);
        }
Example #3
0
 public void ConfigureContainer(ContainerBuilder builder)
 {
     builder.AddApplicationDI();
 }