Пример #1
0
 protected void Application_Start()
 {
     AreaRegistration.RegisterAllAreas();
     FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
     RouteConfig.RegisterRoutes(RouteTable.Routes);
     BundleConfig.RegisterBundles(BundleTable.Bundles);
     MapperInit.Init();
 }
Пример #2
0
 public void Inicializar()
 {
     Mapper.Reset();
     MapperInit.MapearDTOs();
     mockRepositorioCliente = new Mock <IRepositorioCliente>();
     mockRepositorioItem    = new Mock <IRepositorioItem>();
     mockRepositorioPedido  = new Mock <IRepositorioPedido>();
     mockServicoMensageria  = new Mock <IServicoMensageria>();
     mockLogger             = new Mock <ILogger <LojaStoneFacade> >();
 }
Пример #3
0
 public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
 {
     MapperInit.InitMapping();
     app.UseExceptionless("riuCGjWnRDEXcvLASaeRHVdYE9OxHyFtb9SBXPvU");
     app.UseMiddleware <ExceptionHandlerMiddleWare>();
     app.UseCors(builder => builder
                 .AllowAnyOrigin()
                 .AllowAnyMethod()
                 .AllowAnyHeader());
     app.UseMvc();
 }
Пример #4
0
        public static void RegisterDependencies()
        {
            var builder = new ContainerBuilder();

            // IMapper
            builder.Register(c => MapperInit.Init()).AsSelf().SingleInstance();
            builder.Register(c => c.Resolve <MapperConfiguration>().CreateMapper(c.Resolve)).As <IMapper>().InstancePerLifetimeScope();
            var mapperConfig = new MapperConfiguration(m =>
            {
                m.AddProfile(new Mappings.Profile.Profile());
            });

            builder.RegisterInstance(mapperConfig.CreateMapper())
            .As <IMapper>()
            .SingleInstance();

            // DbContext
            builder.RegisterType <VideoClubDbContext>().As <VideoClubDbContext>();

            // Controllers
            builder.RegisterControllers(typeof(MvcApplication).Assembly);

            // ActionFilters

            // Services
            builder.RegisterType <OMDbAPIService>().As <IOMDbAPIService>().InstancePerRequest();
            builder.RegisterType <PaginationService>().As <IPaginationService>().InstancePerRequest();
            builder.RegisterType <LoggingService>().As <ILoggingService>().InstancePerRequest();
            builder.RegisterType <MovieService>().As <IMovieService>().InstancePerRequest();
            builder.RegisterType <RentingService>().As <IRentingService>().InstancePerRequest();
            builder.RegisterType <CopyService>().As <ICopyService>().InstancePerRequest();
            builder.RegisterType <UserService>().As <IUserService>().InstancePerRequest();

            var container = builder.Build();

            DependencyResolver.SetResolver(new AutofacDependencyResolver(container));
        }
Пример #5
0
 public Startup(IConfiguration configuration)
 {
     Configuration           = configuration;
     AutoMapperConfiguration = MapperInit.MappInit();
 }
Пример #6
0
 public Startup(IConfiguration configuration)
 {
     Configuration = configuration;
     MapperInit.MapearDTOs();
 }
Пример #7
0
 protected void Application_Start()
 {
     MapperInit.InitMapping();
     GlobalConfiguration.Configure(WebApiConfig.Register);
 }