示例#1
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_2);

            services.AddDbContext <UserContext>(opt =>
                                                //options.UseSqlServer(Configuration.GetConnectionString("DemoTokenContext"))
                                                opt.UseInMemoryDatabase("AUTH")
                                                );

            services.AddDefaultIdentity <IdentityUser>(options =>
            {
                options.Password.RequiredLength         = 6;
                options.Password.RequireLowercase       = false;
                options.Password.RequireUppercase       = false;
                options.Password.RequireNonAlphanumeric = false;
                options.Password.RequireDigit           = false;
            })
            //.AddRoles<IdentityRole>()
            .AddEntityFrameworkStores <UserContext>()
            .AddDefaultTokenProviders();


            services.AddCors();

            ServicoDeConfiguracaoDeAutenticacao.ConfigurarServicos(services, Configuration);
        }
示例#2
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_2);
            services.Add(new ServiceDescriptor(typeof(IRepositorioDePecas), new RepositorioDePecas()));
            services.AddDbContext <PecaContext>(opt => opt.UseInMemoryDatabase("PROCESSOS"));

            ServicoDeConfiguracaoDeAutenticacao.ConfigurarServicos(services, Configuration);
        }