Пример #1
0
        public static void Config()
        {
            var builder = new ContainerBuilder();

            builder.RegisterControllers(typeof(MvcApplication).Assembly);
            builder.RegisterType <ApiClient.Implementation.ApiClient>()
            .As <IApiClient>()
            .WithParameter(new TypedParameter(typeof(ApiConfigSection), ApiConfig.GetApiConfigSection()))
            .InstancePerDependency();
            builder.RegisterType <ReportService>()
            .As <IReportService>()
            .InstancePerDependency();

            var container = builder.Build();

            DependencyResolver.SetResolver(new AutofacDependencyResolver(container));
        }