private void GetAllDependency(IServiceCollection services) { services.AddSingleton <IAuthorizationHandler, TokenPolicyHandler>(); DLLDependency.ALLDependency(services); BLLDependency.AllDependency(services); UtilityDependency.AllDependency(services); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddControllers().AddFluentValidation(); SetupSwagger(services); services.AddApiVersioning(config => { // Specify the default API Version as 1.0 config.DefaultApiVersion = new ApiVersion(1, 0); // If the client hasn't specified the API version in the request, use the default API version number config.AssumeDefaultVersionWhenUnspecified = true; }); DLLDependency.AllDependency(services, Configuration); BLLDependency.AllDependency(services, Configuration); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddControllers().AddFluentValidation().AddNewtonsoftJson( opt => opt.SerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore);; SetupSwegger(services); services.AddApiVersioning(config => { // Specify the default API Version as 1.0 config.DefaultApiVersion = new ApiVersion(1, 0); // If the client hasn't specified the API version in the request, use the default API version number config.AssumeDefaultVersionWhenUnspecified = true; }); DLLDependency.AllDependency(services, Configuration); BLLDependency.AllDependency(services, Configuration); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddControllers() .AddFluentValidation() .AddNewtonsoftJson(); //.AddFluentValidation(fv => fv.RegisterValidatorsFromAssemblyContaining<StudentCreateRequestViewModelValidator>()); ; services.AddApiVersioning(config => { config.DefaultApiVersion = new ApiVersion(1, 0); config.AssumeDefaultVersionWhenUnspecified = true; config.ReportApiVersions = true; config.ApiVersionReader = new HeaderApiVersionReader("api-version"); }); services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new OpenApiInfo { Title = "WebApplication1", Version = "v1" }); }); DLLDependency.AllDependency(services, Configuration); BLLDependency.AllDependency(services); }