Skip to content

Commit 1f05446

Browse files
committed
Revert "Update SPA templates to use file-scoped namesapces"
This reverts commit 97ff3da.
1 parent 03dadf8 commit 1f05446

File tree

12 files changed

+150
-138
lines changed

12 files changed

+150
-138
lines changed

src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/Controllers/OidcConfigurationController.cs

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,25 @@
22
using Microsoft.AspNetCore.Mvc;
33
using Microsoft.Extensions.Logging;
44

5-
namespace Company.WebApplication1.Controllers;
6-
7-
public class OidcConfigurationController : Controller
5+
namespace Company.WebApplication1.Controllers
86
{
9-
private readonly ILogger<OidcConfigurationController> _logger;
10-
11-
public OidcConfigurationController(IClientRequestParametersProvider clientRequestParametersProvider, ILogger<OidcConfigurationController> logger)
7+
public class OidcConfigurationController : Controller
128
{
13-
ClientRequestParametersProvider = clientRequestParametersProvider;
14-
_logger = logger;
15-
}
9+
private readonly ILogger<OidcConfigurationController> _logger;
1610

17-
public IClientRequestParametersProvider ClientRequestParametersProvider { get; }
11+
public OidcConfigurationController(IClientRequestParametersProvider clientRequestParametersProvider, ILogger<OidcConfigurationController> logger)
12+
{
13+
ClientRequestParametersProvider = clientRequestParametersProvider;
14+
_logger = logger;
15+
}
1816

19-
[HttpGet("_configuration/{clientId}")]
20-
public IActionResult GetClientRequestParameters([FromRoute]string clientId)
21-
{
22-
var parameters = ClientRequestParametersProvider.GetClientParameters(HttpContext, clientId);
23-
return Ok(parameters);
17+
public IClientRequestParametersProvider ClientRequestParametersProvider { get; }
18+
19+
[HttpGet("_configuration/{clientId}")]
20+
public IActionResult GetClientRequestParameters([FromRoute]string clientId)
21+
{
22+
var parameters = ClientRequestParametersProvider.GetClientParameters(HttpContext, clientId);
23+
return Ok(parameters);
24+
}
2425
}
2526
}

src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/Controllers/WeatherForecastController.cs

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -8,36 +8,37 @@
88
using Microsoft.AspNetCore.Mvc;
99
using Microsoft.Extensions.Logging;
1010

11-
namespace Company.WebApplication1.Controllers;
12-
11+
namespace Company.WebApplication1.Controllers
12+
{
1313
#if (!NoAuth)
14-
[Authorize]
14+
[Authorize]
1515
#endif
16-
[ApiController]
17-
[Route("[controller]")]
18-
public class WeatherForecastController : ControllerBase
19-
{
20-
private static readonly string[] Summaries = new[]
16+
[ApiController]
17+
[Route("[controller]")]
18+
public class WeatherForecastController : ControllerBase
2119
{
22-
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
23-
};
20+
private static readonly string[] Summaries = new[]
21+
{
22+
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
23+
};
2424

25-
private readonly ILogger<WeatherForecastController> _logger;
25+
private readonly ILogger<WeatherForecastController> _logger;
2626

27-
public WeatherForecastController(ILogger<WeatherForecastController> logger)
28-
{
29-
_logger = logger;
30-
}
27+
public WeatherForecastController(ILogger<WeatherForecastController> logger)
28+
{
29+
_logger = logger;
30+
}
3131

32-
[HttpGet]
33-
public IEnumerable<WeatherForecast> Get()
34-
{
35-
return Enumerable.Range(1, 5).Select(index => new WeatherForecast
32+
[HttpGet]
33+
public IEnumerable<WeatherForecast> Get()
3634
{
37-
Date = DateTime.Now.AddDays(index),
38-
TemperatureC = Random.Shared.Next(-20, 55),
39-
Summary = Summaries[Random.Shared.Next(Summaries.Length)]
40-
})
41-
.ToArray();
35+
return Enumerable.Range(1, 5).Select(index => new WeatherForecast
36+
{
37+
Date = DateTime.Now.AddDays(index),
38+
TemperatureC = Random.Shared.Next(-20, 55),
39+
Summary = Summaries[Random.Shared.Next(Summaries.Length)]
40+
})
41+
.ToArray();
42+
}
4243
}
4344
}

src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/Data/ApplicationDbContext.cs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,14 @@
88
using System.Linq;
99
using System.Threading.Tasks;
1010

11-
namespace Company.WebApplication1.Data;
12-
13-
public class ApplicationDbContext : ApiAuthorizationDbContext<ApplicationUser>
11+
namespace Company.WebApplication1.Data
1412
{
15-
public ApplicationDbContext(
16-
DbContextOptions options,
17-
IOptions<OperationalStoreOptions> operationalStoreOptions) : base(options, operationalStoreOptions)
13+
public class ApplicationDbContext : ApiAuthorizationDbContext<ApplicationUser>
1814
{
15+
public ApplicationDbContext(
16+
DbContextOptions options,
17+
IOptions<OperationalStoreOptions> operationalStoreOptions) : base(options, operationalStoreOptions)
18+
{
19+
}
1920
}
2021
}

src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/Models/ApplicationUser.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
using System.Linq;
55
using System.Threading.Tasks;
66

7-
namespace Company.WebApplication1.Models;
8-
9-
public class ApplicationUser : IdentityUser
7+
namespace Company.WebApplication1.Models
108
{
9+
public class ApplicationUser : IdentityUser
10+
{
11+
}
1112
}

src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/Pages/Error.cshtml.cs

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,25 @@
77
using Microsoft.AspNetCore.Mvc.RazorPages;
88
using Microsoft.Extensions.Logging;
99

10-
namespace Company.WebApplication1.Pages;
11-
12-
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
13-
public class ErrorModel : PageModel
10+
namespace Company.WebApplication1.Pages
1411
{
15-
private readonly ILogger<ErrorModel> _logger;
16-
17-
public ErrorModel(ILogger<ErrorModel> logger)
12+
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
13+
public class ErrorModel : PageModel
1814
{
19-
_logger = logger;
20-
}
15+
private readonly ILogger<ErrorModel> _logger;
2116

22-
public string? RequestId { get; set; }
17+
public ErrorModel(ILogger<ErrorModel> logger)
18+
{
19+
_logger = logger;
20+
}
2321

24-
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
22+
public string? RequestId { get; set; }
2523

26-
public void OnGet()
27-
{
28-
RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier;
24+
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
25+
26+
public void OnGet()
27+
{
28+
RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier;
29+
}
2930
}
3031
}
Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
using System;
22

3-
namespace Company.WebApplication1;
4-
5-
public class WeatherForecast
3+
namespace Company.WebApplication1
64
{
7-
public DateTime Date { get; set; }
5+
public class WeatherForecast
6+
{
7+
public DateTime Date { get; set; }
88

9-
public int TemperatureC { get; set; }
9+
public int TemperatureC { get; set; }
1010

11-
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
11+
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
1212

13-
public string? Summary { get; set; }
13+
public string? Summary { get; set; }
14+
}
1415
}

src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/Controllers/OidcConfigurationController.cs

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,25 @@
22
using Microsoft.AspNetCore.Mvc;
33
using Microsoft.Extensions.Logging;
44

5-
namespace Company.WebApplication1.Controllers;
6-
7-
public class OidcConfigurationController : Controller
5+
namespace Company.WebApplication1.Controllers
86
{
9-
private readonly ILogger<OidcConfigurationController> _logger;
10-
11-
public OidcConfigurationController(IClientRequestParametersProvider clientRequestParametersProvider, ILogger<OidcConfigurationController> logger)
7+
public class OidcConfigurationController : Controller
128
{
13-
ClientRequestParametersProvider = clientRequestParametersProvider;
14-
_logger = logger;
15-
}
9+
private readonly ILogger<OidcConfigurationController> _logger;
1610

17-
public IClientRequestParametersProvider ClientRequestParametersProvider { get; }
11+
public OidcConfigurationController(IClientRequestParametersProvider clientRequestParametersProvider, ILogger<OidcConfigurationController> logger)
12+
{
13+
ClientRequestParametersProvider = clientRequestParametersProvider;
14+
_logger = logger;
15+
}
1816

19-
[HttpGet("_configuration/{clientId}")]
20-
public IActionResult GetClientRequestParameters([FromRoute]string clientId)
21-
{
22-
var parameters = ClientRequestParametersProvider.GetClientParameters(HttpContext, clientId);
23-
return Ok(parameters);
17+
public IClientRequestParametersProvider ClientRequestParametersProvider { get; }
18+
19+
[HttpGet("_configuration/{clientId}")]
20+
public IActionResult GetClientRequestParameters([FromRoute]string clientId)
21+
{
22+
var parameters = ClientRequestParametersProvider.GetClientParameters(HttpContext, clientId);
23+
return Ok(parameters);
24+
}
2425
}
2526
}

src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/Controllers/WeatherForecastController.cs

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -8,36 +8,37 @@
88
using Microsoft.AspNetCore.Mvc;
99
using Microsoft.Extensions.Logging;
1010

11-
namespace Company.WebApplication1.Controllers;
12-
11+
namespace Company.WebApplication1.Controllers
12+
{
1313
#if (!NoAuth)
14-
[Authorize]
14+
[Authorize]
1515
#endif
16-
[ApiController]
17-
[Route("[controller]")]
18-
public class WeatherForecastController : ControllerBase
19-
{
20-
private static readonly string[] Summaries = new[]
16+
[ApiController]
17+
[Route("[controller]")]
18+
public class WeatherForecastController : ControllerBase
2119
{
22-
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
23-
};
20+
private static readonly string[] Summaries = new[]
21+
{
22+
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
23+
};
2424

25-
private readonly ILogger<WeatherForecastController> _logger;
25+
private readonly ILogger<WeatherForecastController> _logger;
2626

27-
public WeatherForecastController(ILogger<WeatherForecastController> logger)
28-
{
29-
_logger = logger;
30-
}
27+
public WeatherForecastController(ILogger<WeatherForecastController> logger)
28+
{
29+
_logger = logger;
30+
}
3131

32-
[HttpGet]
33-
public IEnumerable<WeatherForecast> Get()
34-
{
35-
return Enumerable.Range(1, 5).Select(index => new WeatherForecast
32+
[HttpGet]
33+
public IEnumerable<WeatherForecast> Get()
3634
{
37-
Date = DateTime.Now.AddDays(index),
38-
TemperatureC = Random.Shared.Next(-20, 55),
39-
Summary = Summaries[Random.Shared.Next(Summaries.Length)]
40-
})
41-
.ToArray();
35+
return Enumerable.Range(1, 5).Select(index => new WeatherForecast
36+
{
37+
Date = DateTime.Now.AddDays(index),
38+
TemperatureC = Random.Shared.Next(-20, 55),
39+
Summary = Summaries[Random.Shared.Next(Summaries.Length)]
40+
})
41+
.ToArray();
42+
}
4243
}
4344
}

src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/Data/ApplicationDbContext.cs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,14 @@
88
using System.Linq;
99
using System.Threading.Tasks;
1010

11-
namespace Company.WebApplication1.Data;
12-
13-
public class ApplicationDbContext : ApiAuthorizationDbContext<ApplicationUser>
11+
namespace Company.WebApplication1.Data
1412
{
15-
public ApplicationDbContext(
16-
DbContextOptions options,
17-
IOptions<OperationalStoreOptions> operationalStoreOptions) : base(options, operationalStoreOptions)
13+
public class ApplicationDbContext : ApiAuthorizationDbContext<ApplicationUser>
1814
{
15+
public ApplicationDbContext(
16+
DbContextOptions options,
17+
IOptions<OperationalStoreOptions> operationalStoreOptions) : base(options, operationalStoreOptions)
18+
{
19+
}
1920
}
2021
}

src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/Models/ApplicationUser.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
using System.Linq;
55
using System.Threading.Tasks;
66

7-
namespace Company.WebApplication1.Models;
8-
9-
public class ApplicationUser : IdentityUser
7+
namespace Company.WebApplication1.Models
108
{
9+
public class ApplicationUser : IdentityUser
10+
{
11+
}
1112
}

src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/Pages/Error.cshtml.cs

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,25 @@
77
using Microsoft.AspNetCore.Mvc.RazorPages;
88
using Microsoft.Extensions.Logging;
99

10-
namespace Company.WebApplication1.Pages;
11-
12-
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
13-
public class ErrorModel : PageModel
10+
namespace Company.WebApplication1.Pages
1411
{
15-
private readonly ILogger<ErrorModel> _logger;
16-
17-
public ErrorModel(ILogger<ErrorModel> logger)
12+
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
13+
public class ErrorModel : PageModel
1814
{
19-
_logger = logger;
20-
}
15+
private readonly ILogger<ErrorModel> _logger;
2116

22-
public string? RequestId { get; set; }
17+
public ErrorModel(ILogger<ErrorModel> logger)
18+
{
19+
_logger = logger;
20+
}
2321

24-
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
22+
public string? RequestId { get; set; }
2523

26-
public void OnGet()
27-
{
28-
RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier;
24+
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
25+
26+
public void OnGet()
27+
{
28+
RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier;
29+
}
2930
}
3031
}
Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
using System;
22

3-
namespace Company.WebApplication1;
4-
5-
public class WeatherForecast
3+
namespace Company.WebApplication1
64
{
7-
public DateTime Date { get; set; }
5+
public class WeatherForecast
6+
{
7+
public DateTime Date { get; set; }
88

9-
public int TemperatureC { get; set; }
9+
public int TemperatureC { get; set; }
1010

11-
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
11+
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
1212

13-
public string? Summary { get; set; }
13+
public string? Summary { get; set; }
14+
}
1415
}

0 commit comments

Comments
 (0)