Example #1
0
        public void ConfigureServices(IServiceCollection services)
        {
            //Configure AppSettings section
            var appConfig = Configuration.GetSection("AppSettings");

            services.Configure <AppSettings>(appConfig);

            //Using AppSettings
            var    appSettings      = appConfig.Get <AppSettings>();
            string connectionString = appSettings.CommanderConnectionString;

            DIModule.Register(services, connectionString);


            services.AddControllers().AddNewtonsoftJson(s =>
            {
                s.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();
            });


            //Mapping to DTO's
            services.AddAutoMapper(AppDomain.CurrentDomain.GetAssemblies());



            //Registering services
            //services.AddScoped<ICommanderRepo, CommanderRepo>();
            services.AddScoped <ICommanderRepo, SqlCommanderRepo>();
        }