Ejemplo n.º 1
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddControllers();
            services.AddSwaggerGen(c =>
            {
                c.SwaggerDoc("v1", new OpenApiInfo {
                    Title = "PackagingService", Version = "v1"
                });
            });
            // configure strongly typed settings object
            services.Configure <AppRequirements>(Configuration.GetSection("AppSettings"));
            // configure DI for application services
            services.AddScoped <IPackageSortingService, PackageSortingService>();
            // configure DI for helper classes
            ValidateInput validateInput = new ValidateInput();

            services.AddSingleton <ValidateInput>(validateInput);
            ValidatePackage validatePackage = new ValidatePackage();

            services.AddSingleton <ValidatePackage>(validatePackage);
        }
Ejemplo n.º 2
0
 public PackageSortingService(ValidatePackage validatePackage)
 {
     _validatePackage = validatePackage;
 }