// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { // Add framework services. services.AddMvc().AddXmlSerializerFormatters(); IBookChaptersRepository repos = new SampleBookChaptersRepository(); repos.Init(); services.AddSingleton(repos); services.AddSwaggerGen(); services.ConfigureSwaggerGen(options => { options.SingleApiVersion(new Info { Version = "v1", Title = "Book Chapters", Description = "A sample for Professional C# 6" }); options.IgnoreObsoleteActions(); options.IgnoreObsoleteProperties(); options.DescribeAllEnumsAsStrings(); }); }