Skip to content
This repository has been archived by the owner on Sep 21, 2018. It is now read-only.

Commit

Permalink
Address feedback for Startup.cs
Browse files Browse the repository at this point in the history
* Remove configuation sources comment
* Remove Configuration property settor
* Add newline before app.UseStaticFiles()
  • Loading branch information
phenning committed Apr 26, 2016
1 parent 4521a05 commit 53f174b
Show file tree
Hide file tree
Showing 16 changed files with 27 additions and 33 deletions.
3 changes: 1 addition & 2 deletions src/BaseTemplates/StarterWeb/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ public class Startup
{
public Startup(IHostingEnvironment env)
{
// Set up configuration sources.
var builder = new ConfigurationBuilder()
.SetBasePath(env.ContentRootPath)
.AddJsonFile(source =>
Expand All @@ -27,7 +26,7 @@ public Startup(IHostingEnvironment env)
Configuration = builder.Build();
}

public IConfigurationRoot Configuration { get; set; }
public IConfigurationRoot Configuration { get; }

// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
Expand Down
3 changes: 1 addition & 2 deletions src/BaseTemplates/WebAPI/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ public class Startup
{
public Startup(IHostingEnvironment env)
{
// Set up configuration sources.
var builder = new ConfigurationBuilder()
.SetBasePath(env.ContentRootPath)
.AddJsonFile(source =>
Expand All @@ -27,7 +26,7 @@ public Startup(IHostingEnvironment env)
Configuration = builder.Build();
}

public IConfigurationRoot Configuration { get; set; }
public IConfigurationRoot Configuration { get; }

// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
Expand Down
5 changes: 2 additions & 3 deletions src/Rules/StarterWeb/AI/IndividualAuth/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ public class Startup
{
public Startup(IHostingEnvironment env)
{
// Set up configuration sources.

var builder = new ConfigurationBuilder()
.SetBasePath(env.ContentRootPath)
.AddJsonFile(source =>
Expand All @@ -43,7 +41,7 @@ public Startup(IHostingEnvironment env)
Configuration = builder.Build();
}

public IConfigurationRoot Configuration { get; set; }
public IConfigurationRoot Configuration { get; }

// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
Expand Down Expand Up @@ -94,6 +92,7 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerF
}
catch { }
}

app.UseApplicationInsightsExceptionTelemetry();

app.UseStaticFiles();
Expand Down
4 changes: 2 additions & 2 deletions src/Rules/StarterWeb/AI/NoAuth/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ public class Startup
{
public Startup(IHostingEnvironment env)
{
// Set up configuration sources.
var builder = new ConfigurationBuilder()
.SetBasePath(env.ContentRootPath)
.AddJsonFile(source =>
Expand All @@ -33,7 +32,7 @@ public Startup(IHostingEnvironment env)
Configuration = builder.Build();
}

public IConfigurationRoot Configuration { get; set; }
public IConfigurationRoot Configuration { get; }

// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
Expand Down Expand Up @@ -61,6 +60,7 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerF
{
app.UseExceptionHandler("/Home/Error");
}

app.UseApplicationInsightsExceptionTelemetry();

app.UseStaticFiles();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ public class Startup
{
public Startup(IHostingEnvironment env)
{
// Set up configuration sources.
var builder = new ConfigurationBuilder()
.SetBasePath(env.ContentRootPath)
.AddJsonFile(source =>
Expand All @@ -39,7 +38,7 @@ public Startup(IHostingEnvironment env)
Configuration = builder.Build();
}

public IConfigurationRoot Configuration { get; set; }
public IConfigurationRoot Configuration { get; }

// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
Expand Down Expand Up @@ -70,6 +69,7 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerF
{
app.UseExceptionHandler("/Home/Error");
}

app.UseApplicationInsightsExceptionTelemetry();

app.UseStaticFiles();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ public class Startup
{
public Startup(IHostingEnvironment env)
{
// Set up configuration sources.
var builder = new ConfigurationBuilder()
.SetBasePath(env.ContentRootPath)
.AddJsonFile(source =>
Expand All @@ -39,7 +38,7 @@ public Startup(IHostingEnvironment env)
Configuration = builder.Build();
}

public IConfigurationRoot Configuration { get; set; }
public IConfigurationRoot Configuration { get; }

// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
Expand Down Expand Up @@ -70,6 +69,7 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerF
{
app.UseExceptionHandler("/Home/Error");
}

app.UseApplicationInsightsExceptionTelemetry();

app.UseStaticFiles();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ public class Startup
{
public Startup(IHostingEnvironment env)
{
// Set up configuration sources.
var builder = new ConfigurationBuilder()
.SetBasePath(env.ContentRootPath)
.AddJsonFile(source =>
Expand All @@ -37,7 +36,7 @@ public Startup(IHostingEnvironment env)
Configuration = builder.Build();
}

public IConfigurationRoot Configuration { get; set; }
public IConfigurationRoot Configuration { get; }

// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
Expand Down Expand Up @@ -68,6 +67,7 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerF
{
app.UseExceptionHandler("/Home/Error");
}

app.UseApplicationInsightsExceptionTelemetry();

app.UseStaticFiles();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ public class Startup
{
public Startup(IHostingEnvironment env)
{
// Set up configuration sources.
var builder = new ConfigurationBuilder()
.SetBasePath(env.ContentRootPath)
.AddJsonFile(source =>
Expand All @@ -37,7 +36,7 @@ public Startup(IHostingEnvironment env)
Configuration = builder.Build();
}

public IConfigurationRoot Configuration { get; set; }
public IConfigurationRoot Configuration { get; }

// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
Expand Down Expand Up @@ -68,6 +67,7 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerF
{
app.UseExceptionHandler("/Home/Error");
}

app.UseApplicationInsightsExceptionTelemetry();

app.UseStaticFiles();
Expand Down
4 changes: 2 additions & 2 deletions src/Rules/StarterWeb/IndividualAuth/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ public class Startup
{
public Startup(IHostingEnvironment env)
{
// Set up configuration sources.
var builder = new ConfigurationBuilder()
.SetBasePath(env.ContentRootPath)
.AddJsonFile(source =>
Expand All @@ -39,7 +38,7 @@ public Startup(IHostingEnvironment env)
Configuration = builder.Build();
}

public IConfigurationRoot Configuration { get; set; }
public IConfigurationRoot Configuration { get; }

// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
Expand Down Expand Up @@ -86,6 +85,7 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerF
}
catch { }
}

app.UseStaticFiles();

app.UseIdentity();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ public class Startup
{
public Startup(IHostingEnvironment env)
{
// Set up configuration sources.
var builder = new ConfigurationBuilder()
.SetBasePath(env.ContentRootPath)
.AddJsonFile(source =>
Expand All @@ -37,7 +36,7 @@ public Startup(IHostingEnvironment env)
Configuration = builder.Build();
}

public IConfigurationRoot Configuration { get; set; }
public IConfigurationRoot Configuration { get; }

// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
Expand All @@ -64,6 +63,7 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerF
{
app.UseExceptionHandler("/Home/Error");
}

app.UseStaticFiles();

app.UseCookieAuthentication();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ public class Startup
{
public Startup(IHostingEnvironment env)
{
// Set up configuration sources.
var builder = new ConfigurationBuilder()
.SetBasePath(env.ContentRootPath)
.AddJsonFile(source =>
Expand All @@ -37,7 +36,7 @@ public Startup(IHostingEnvironment env)
Configuration = builder.Build();
}

public IConfigurationRoot Configuration { get; set; }
public IConfigurationRoot Configuration { get; }

// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
Expand All @@ -64,6 +63,7 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerF
{
app.UseExceptionHandler("/Home/Error");
}

app.UseStaticFiles();

app.UseCookieAuthentication();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ public class Startup
{
public Startup(IHostingEnvironment env)
{
// Set up configuration sources.
var builder = new ConfigurationBuilder()
.SetBasePath(env.ContentRootPath)
.AddJsonFile(source =>
Expand All @@ -35,7 +34,7 @@ public Startup(IHostingEnvironment env)
Configuration = builder.Build();
}

public IConfigurationRoot Configuration { get; set; }
public IConfigurationRoot Configuration { get; }

// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
Expand All @@ -62,6 +61,7 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerF
{
app.UseExceptionHandler("/Home/Error");
}

app.UseStaticFiles();

app.UseCookieAuthentication();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ public class Startup
{
public Startup(IHostingEnvironment env)
{
// Set up configuration sources.
var builder = new ConfigurationBuilder()
.SetBasePath(env.ContentRootPath)
.AddJsonFile(source =>
Expand All @@ -35,7 +34,7 @@ public Startup(IHostingEnvironment env)
Configuration = builder.Build();
}

public IConfigurationRoot Configuration { get; set; }
public IConfigurationRoot Configuration { get; }

// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
Expand All @@ -62,6 +61,7 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerF
{
app.UseExceptionHandler("/Home/Error");
}

app.UseStaticFiles();

app.UseCookieAuthentication();
Expand Down
3 changes: 1 addition & 2 deletions src/Rules/WebAPI/AI/NoAuth/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ public class Startup
{
public Startup(IHostingEnvironment env)
{
// Set up configuration sources.
var builder = new ConfigurationBuilder()
.SetBasePath(env.ContentRootPath)
.AddJsonFile(source =>
Expand All @@ -34,7 +33,7 @@ public Startup(IHostingEnvironment env)
Configuration = builder.Build();
}

public IConfigurationRoot Configuration { get; set; }
public IConfigurationRoot Configuration { get; }

// This method gets called by the runtime. Use this method to add services to the container
public void ConfigureServices(IServiceCollection services)
Expand Down
3 changes: 1 addition & 2 deletions src/Rules/WebAPI/AI/OrganizationalAuth/Single/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ public class Startup
{
public Startup(IHostingEnvironment env)
{
// Set up configuration sources.
var builder = new ConfigurationBuilder()
.SetBasePath(env.ContentRootPath)
.AddJsonFile(source =>
Expand All @@ -36,7 +35,7 @@ public Startup(IHostingEnvironment env)
Configuration = builder.Build();
}

public IConfigurationRoot Configuration { get; set; }
public IConfigurationRoot Configuration { get; }

// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
Expand Down
3 changes: 1 addition & 2 deletions src/Rules/WebAPI/OrganizationalAuth/Single/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ public class Startup
{
public Startup(IHostingEnvironment env)
{
// Set up configuration sources.
var builder = new ConfigurationBuilder()
.SetBasePath(env.ContentRootPath)
.AddJsonFile(source =>
Expand All @@ -34,7 +33,7 @@ public Startup(IHostingEnvironment env)
Configuration = builder.Build();
}

public IConfigurationRoot Configuration { get; set; }
public IConfigurationRoot Configuration { get; }

// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
Expand Down

0 comments on commit 53f174b

Please sign in to comment.