Beispiel #1
0
        // This method gets called by the runtime. Use this method to add services to the container.
        // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
        public void ConfigureServices(IServiceCollection services)
        {
            ServicesConfiguration.ConfigureServices(services);
            services.AddAutoMapper(AppDomain.CurrentDomain.GetAssemblies());
            services.AddMvc(options =>
            {
                options.RespectBrowserAcceptHeader = true;
                options.OutputFormatters.Add(new XmlDataContractSerializerOutputFormatter());
            });

            services.AddSession();
        }
Beispiel #2
0
 // This method gets called by the runtime. Use this method to add services to the container.
 // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
 public void ConfigureServices(IServiceCollection services)
 {
     ServicesConfiguration.ConfigureServices(services);
     services.AddAutoMapper(AppDomain.CurrentDomain.GetAssemblies());
     services.AddMvc(options =>
     {
         options.RespectBrowserAcceptHeader = true;
     })
     .AddXmlSerializerFormatters()
     .AddJsonOptions(
         options => options.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore
         );
 }
Beispiel #3
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
            var connString = Environment.GetEnvironmentVariable("CONN_STRING");

            ServicesConfiguration.ConfigureServices(services, connString);

            services.AddSwaggerGen(c =>
            {
                c.SwaggerDoc("v1", new Swashbuckle.AspNetCore.Swagger.Info {
                    Title = "Cinema API", Version = "v1"
                });
            });
        }
Beispiel #4
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            var servicesConfig = new ServicesConfiguration();
            Action <IMapperConfigurationExpression> mapperConfig = configure =>
            {
                configure.CreateMap <Blog, BlogFormModel>().ReverseMap();
            };

            servicesConfig.ConfigureServices(services, Configuration, WebHostEnvironment, mapperConfig);
            //services.Configure<IISOptions>(options =>
            //{
            //    options.ForwardClientCertificate = false;
            //    options.AutomaticAuthentication = false;
            //});
            services.AddControllersWithViews();
            services.AddRazorPages();
            services.AddMvc(options => options.EnableEndpointRouting = false)
            .SetCompatibilityVersion(Microsoft.AspNetCore.Mvc.CompatibilityVersion.Version_3_0);
            services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme)
            .AddCookie(CookieAuthenticationDefaults.AuthenticationScheme)
            .AddGoogle(options => {
                //options.SignInScheme = CookieAuthenticationDefaults.AuthenticationScheme;
                options.ClientId     = "910859426143-uvqv4uglqgr96h5lghsd013thi4bfkgu.apps.googleusercontent.com";
                options.ClientSecret = "1dlWOhd1rQ-5intVMd1y2HDZ";
                //options.CallbackPath = "/google-signin";
            });
            services.AddSignalR();
            services.Configure <IISServerOptions>(options =>
            {
                options.AutomaticAuthentication = false;
            });

            // Register services
            services.AddScoped <IUserManager, UserManager>();
            services.AddTransient <ICookieService, CookieService>();
            services.AddTransient <IFileHandler, FileHandler>();
            services.AddTransient <IMenuViewModelService, MenuViewModelService>();
            services.AddTransient <ILayoutViewModelService, LayoutViewModelService>();
            services.AddTransient <IHomeViewModelService, HomeViewModelService>();
            services.AddTransient <IRoleViewModelService, RoleViewModelService>();
            services.AddTransient <IUserViewModelService, UserViewModelService>();
            services.AddTransient <ICategoryViewModelService, CategoryViewModelService>();
            services.AddTransient <IBlogViewModelService, BlogViewModelService>();
            services.AddTransient <IViewModelFactory, ViewModelFactory>();
            services.AddTransient(typeof(Lazy <>), typeof(LazyLoader <>));
            services.AddHttpContextAccessor();
        }
 // This method gets called by the runtime. Use this method to add services to the container.
 // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
 public void ConfigureServices(IServiceCollection services)
 {
     services.AddMvc();
     ServicesConfiguration.ConfigureServices(services);
 }