AdvancedWf.Web/App_Start/Bootstrapper.cs
/// <summary>
///   here  as  you  know  in any  concepts  Bootsrapper  that  you  make  the   startup  or   initiate the  project   and  here  we  will  use  autofac .
///   I will  Explain it  later
/// </summary>
here  as  you  know  in any  concepts  Bootsrapper  that  you  make  the   startup  or   initiate the  project   and  here  we  will  use  autofac .
I will  Explain it  later
here as you know in any concepts Bootsrapper that you make the startup or initiate the project and here we will use autofac . I will Explain it later
private static void SetAutofacContainer()
        {
            var builder = new ContainerBuilder();
            builder.RegisterControllers(Assembly.GetExecutingAssembly());
            builder.RegisterType<UnitOfWork>().As<IUnitOfWork>().InstancePerRequest();
            builder.RegisterType<DbFactory>().As<IDbFactory>().InstancePerRequest();
            builder.RegisterAssemblyTypes(typeof(GadgetRepository).Assembly)
                .Where(t => t.Name.EndsWith("Repository"))
                .AsImplementedInterfaces().InstancePerRequest();
            builder.RegisterAssemblyTypes(typeof(GadgetService).Assembly)
               .Where(t => t.Name.EndsWith("Service"))
               .AsImplementedInterfaces().InstancePerRequest();
            IContainer container = builder.Build();
            DependencyResolver.SetResolver(new AutofacDependencyResolver(container));
        }
private static void SetAutofacContainer ( ) { var builder = new ContainerBuilder ( ) ; builder . RegisterControllers ( Assembly . GetExecutingAssembly ( ) ) ; builder . RegisterType < UnitOfWork > ( ) . As < IUnitOfWork > ( ) . InstancePerRequest ( ) ; builder . RegisterType < DbFactory > ( ) . As < IDbFactory > ( ) . InstancePerRequest ( ) ; builder . RegisterAssemblyTypes ( typeof ( GadgetRepository ) . Assembly ) . Where ( t => t . Name . EndsWith ( " " ) ) . AsImplementedInterfaces ( ) . InstancePerRequest ( ) ; builder . RegisterAssemblyTypes ( typeof ( GadgetService ) . Assembly ) . Where ( t => t . Name . EndsWith ( " " ) ) . AsImplementedInterfaces ( ) . InstancePerRequest ( ) ; IContainer container = builder . Build ( ) ; DependencyResolver . SetResolver ( new AutofacDependencyResolver ( container ) ) ; }
here  as  you  know  in any  concepts  Bootsrapper  that  you  make  the   startup  or   initiate the  project   and  here  we  will  use  autofac .
here as you know in any concepts Bootsrapper that you make the startup or initiate the project and here we will use autofac .
// Repositories // Services