// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services .AddControllers(options => { options.Filters.Add(typeof(ValidationFilter)); options.Filters.Add(typeof(ExceptionFilter)); }) .AddNewtonsoftJson(options => { options.SerializerSettings.ContractResolver = new Newtonsoft.Json.Serialization.CamelCasePropertyNamesContractResolver(); options.SerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore; }) .AddFluentValidation(options => { options.RegisterValidatorsFromAssembly(ApplicationRegistry.GetAssembly()); }); services.Configure <ServerSettings>( Configuration.GetSection("Server")); services.Configure <MongoConnectionSettings>( Configuration.GetSection("MongoConnection")); services.Configure <MongoContextSettings <RegistryContext> >( Configuration.GetSection("MongoConnection:Registry")); services.Configure <MongoContextSettings <GameContext> >( Configuration.GetSection("MongoConnection:Game")); services.Configure <EmailSenderSettings>( Configuration.GetSection("SmtpServer")); services.Configure <DefaultUsersSettings>( Configuration.GetSection("DefaultUsers")); services.RegisterDomainLayer(Configuration["MongoConnection:ConnectionString"]); services.RegisterApplicationLayer(); }