示例#1
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddDbContext <IFLikeContext>(options =>
                                                  options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")));


            services.AddAuthentication(sharedOptions =>
            {
                sharedOptions.DefaultScheme          = CookieAuthenticationDefaults.AuthenticationScheme;
                sharedOptions.DefaultChallengeScheme = OpenIdConnectDefaults.AuthenticationScheme;
            })
            .AddAzureAd(options => Configuration.Bind("AzureAd", options))
            .AddCookie();

            DependencyInjections.AddDependencyInjections(services);
            services.AddAutoMapper(x => AutoMapperConfig.GetConfig());
            services.AddMvc();
        }
示例#2
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddDbContext <IFLikeContext>(options =>
                                                  options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")));

            services.AddIdentity <ApplicationUser, IdentityRole>()
            .AddEntityFrameworkStores <IFLikeContext>()
            .AddDefaultTokenProviders();

            services.AddAuthentication().AddFacebook(facebookOptions =>
            {
                facebookOptions.AppId     = "1521598354575145";
                facebookOptions.AppSecret = "d5cec77e269fa5de45781bdbbf380e4a";
            });

            DependencyInjections.AddDependencyInjections(services);
            services.AddMvc();

            services.AddSignalR();
        }