private static IContainer RegisterServices(ContainerBuilder builder) { //Register your Web API controllers. builder.RegisterApiControllers(Assembly.GetExecutingAssembly()); builder.RegisterType <AutoMapperConfig>(); AutoMapperConfig.AutoMapper(); AutoMapperConfig.AutoMapperInverse(); builder.RegisterType <EmployeeDao>() .As <IEmployeeDao>() .InstancePerRequest(); //Set the dependency resolver to be Autofac. Container = builder.Build(); return(Container); }