Esempio n. 1
0
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddControllers()
            .ConfigureApiBehaviorOptions(opt =>
                                         opt.InvalidModelStateResponseFactory = actionContext => CustomModelValidationResponse(actionContext))
            .AddJsonOptions(options =>
                            options.JsonSerializerOptions.PropertyNamingPolicy = SnakeCaseNamingPolicy.Instance);

            services.AddMvc(opt =>
            {
                opt.UseGeneralRoutePrefix("api/v{version:apiVersion}");

                var policy = new AuthorizationPolicyBuilder()
                             .RequireAuthenticatedUser()
                             .Build();
                opt.Filters.Add(new AuthorizeFilter(policy));
            });

            var appSettingsSection = Configuration.GetSection(nameof(AppSettings));

            services.Configure <AppSettings>(appSettingsSection);

            services.AddJwt(appSettingsSection);

            services.AddVersioningVibbra();

            services.AddSwaggerVibbra();

            services.AddResponseCompression();

            services.AddDbContext <VibbraContext>(options =>
            {
                VibbraContext.Configurar(options, Configuration.GetConnectionString("Default"), WebHostEnvironmen.IsDevelopment());
            });

            services.AddRepositoriesAndServices();
        }
Esempio n. 2
0
 public CategoryRepository(VibbraContext context) : base(context, context.Category)
 {
 }
Esempio n. 3
0
 public RepositoryBase(VibbraContext context, DbSet <T> set)
 {
     Context = context;
     Set     = set;
 }
Esempio n. 4
0
 public TimeRepository(VibbraContext context)
 {
     _context = context;
 }
Esempio n. 5
0
 public ProjectRepository(VibbraContext context)
 {
     _context = context;
 }
 public ConfigurationRepository(VibbraContext context) : base(context, context.Configuration)
 {
 }
Esempio n. 7
0
 public UserRepository(VibbraContext vibbraContext)
 {
     _vibbraContext = vibbraContext;
 }
 public CustomerRepository(VibbraContext context) : base(context, context.Customer)
 {
 }
 public ExpenseRepository(VibbraContext context) : base(context, context.Expense)
 {
 }