-
Notifications
You must be signed in to change notification settings - Fork 10k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update templates to use file scoped namespace declarations (#34220)
* Update templates to use file-scoped namespace declarations * Move to SDK version that supports file-scoped namespaces * Make CA1305 a suggestion rather than error - New compiler now makes this appear when using a StringBuilder with string interpolation. Logged #34361 to follow up. Contributes to #33947
- Loading branch information
1 parent
81e3824
commit 25767de
Showing
27 changed files
with
506 additions
and
529 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 5 additions & 6 deletions
11
...emplates/Web.ProjectTemplates/content/BlazorServerWeb-CSharp/Data/ApplicationDbContext.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,12 @@ | ||
using Microsoft.AspNetCore.Identity.EntityFrameworkCore; | ||
using Microsoft.EntityFrameworkCore; | ||
|
||
namespace BlazorServerWeb_CSharp.Data | ||
namespace BlazorServerWeb_CSharp.Data; | ||
|
||
public class ApplicationDbContext : IdentityDbContext | ||
{ | ||
public class ApplicationDbContext : IdentityDbContext | ||
public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options) | ||
: base(options) | ||
{ | ||
public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options) | ||
: base(options) | ||
{ | ||
} | ||
} | ||
} |
15 changes: 7 additions & 8 deletions
15
...jectTemplates/Web.ProjectTemplates/content/BlazorServerWeb-CSharp/Data/WeatherForecast.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,12 @@ | ||
namespace BlazorServerWeb_CSharp.Data | ||
namespace BlazorServerWeb_CSharp.Data; | ||
|
||
public class WeatherForecast | ||
{ | ||
public class WeatherForecast | ||
{ | ||
public DateTime Date { get; set; } | ||
public DateTime Date { get; set; } | ||
|
||
public int TemperatureC { get; set; } | ||
public int TemperatureC { get; set; } | ||
|
||
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); | ||
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); | ||
|
||
public string? Summary { get; set; } | ||
} | ||
public string? Summary { get; set; } | ||
} |
27 changes: 13 additions & 14 deletions
27
...plates/Web.ProjectTemplates/content/BlazorServerWeb-CSharp/Data/WeatherForecastService.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,19 @@ | ||
namespace BlazorServerWeb_CSharp.Data | ||
namespace BlazorServerWeb_CSharp.Data; | ||
|
||
public class WeatherForecastService | ||
{ | ||
public class WeatherForecastService | ||
private static readonly string[] Summaries = new[] | ||
{ | ||
private static readonly string[] Summaries = new[] | ||
{ | ||
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" | ||
}; | ||
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" | ||
}; | ||
|
||
public Task<WeatherForecast[]> GetForecastAsync(DateTime startDate) | ||
public Task<WeatherForecast[]> GetForecastAsync(DateTime startDate) | ||
{ | ||
return Task.FromResult(Enumerable.Range(1, 5).Select(index => new WeatherForecast | ||
{ | ||
return Task.FromResult(Enumerable.Range(1, 5).Select(index => new WeatherForecast | ||
{ | ||
Date = startDate.AddDays(index), | ||
TemperatureC = Random.Shared.Next(-20, 55), | ||
Summary = Summaries[Random.Shared.Next(Summaries.Length)] | ||
}).ToArray()); | ||
} | ||
Date = startDate.AddDays(index), | ||
TemperatureC = Random.Shared.Next(-20, 55), | ||
Summary = Summaries[Random.Shared.Next(Summaries.Length)] | ||
}).ToArray()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 15 additions & 16 deletions
31
...es/content/ComponentsWebAssembly-CSharp/Server/Controllers/OidcConfigurationController.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,24 @@ | ||
using Microsoft.AspNetCore.ApiAuthorization.IdentityServer; | ||
using Microsoft.AspNetCore.Mvc; | ||
|
||
namespace ComponentsWebAssembly_CSharp.Server.Controllers | ||
namespace ComponentsWebAssembly_CSharp.Server.Controllers; | ||
|
||
public class OidcConfigurationController : Controller | ||
{ | ||
public class OidcConfigurationController : Controller | ||
{ | ||
private readonly ILogger<OidcConfigurationController> _logger; | ||
private readonly ILogger<OidcConfigurationController> _logger; | ||
|
||
public OidcConfigurationController(IClientRequestParametersProvider clientRequestParametersProvider, ILogger<OidcConfigurationController> logger) | ||
{ | ||
ClientRequestParametersProvider = clientRequestParametersProvider; | ||
_logger = logger; | ||
} | ||
public OidcConfigurationController(IClientRequestParametersProvider clientRequestParametersProvider, ILogger<OidcConfigurationController> logger) | ||
{ | ||
ClientRequestParametersProvider = clientRequestParametersProvider; | ||
_logger = logger; | ||
} | ||
|
||
public IClientRequestParametersProvider ClientRequestParametersProvider { get; } | ||
public IClientRequestParametersProvider ClientRequestParametersProvider { get; } | ||
|
||
[HttpGet("_configuration/{clientId}")] | ||
public IActionResult GetClientRequestParameters([FromRoute]string clientId) | ||
{ | ||
var parameters = ClientRequestParametersProvider.GetClientParameters(HttpContext, clientId); | ||
return Ok(parameters); | ||
} | ||
[HttpGet("_configuration/{clientId}")] | ||
public IActionResult GetClientRequestParameters([FromRoute]string clientId) | ||
{ | ||
var parameters = ClientRequestParametersProvider.GetClientParameters(HttpContext, clientId); | ||
return Ok(parameters); | ||
} | ||
} |
Oops, something went wrong.