Skip to content

Commit dfbaef6

Browse files
committed
refactor: Move usings to global file
1 parent db16f85 commit dfbaef6

40 files changed

+102
-182
lines changed

examples/WeatherForecast/Packages.props

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
<Project>
33
<ItemGroup>
44
<PackageReference Update="JetBrains.Annotations" Version="2023.2.0" PrivateAssets="all"/>
5-
<PackageReference Update="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.21"/>
6-
<PackageReference Update="Microsoft.EntityFrameworkCore" Version="6.0.21"/>
7-
<PackageReference Update="Microsoft.Fast.Components.FluentUI" Version="3.0.1"/>
5+
<PackageReference Update="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.23"/>
6+
<PackageReference Update="Microsoft.EntityFrameworkCore" Version="6.0.23"/>
7+
<PackageReference Update="Microsoft.Fast.Components.FluentUI" Version="3.2.0"/>
88
<PackageReference Update="Testcontainers.SqlEdge" Version="3.5.0"/>
99
<PackageReference Update="System.ComponentModel.Annotations" Version="5.0.0"/>
1010
<PackageReference Update="System.Text.Json" Version="6.0.8"/>
11-
<PackageReference Update="Microsoft.AspNetCore.Mvc.Testing" Version="6.0.21"/>
11+
<PackageReference Update="Microsoft.AspNetCore.Mvc.Testing" Version="6.0.23"/>
1212
<PackageReference Update="Microsoft.NET.Test.Sdk" Version="17.7.2"/>
1313
<PackageReference Update="Selenium.WebDriver.ChromeDriver" Version="106.0.5249.6100"/>
1414
<PackageReference Update="Selenium.WebDriver" Version="4.9.1"/>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
global using System;
2+
global using System.Collections.Generic;
3+
global using System.Linq;
4+
global using System.Threading.Tasks;
5+
global using JetBrains.Annotations;
6+
global using Microsoft.EntityFrameworkCore;
7+
global using WeatherForecast.Entities;
8+
global using WeatherForecast.Repositories;

examples/WeatherForecast/src/WeatherForecast.Contexts/WeatherDataContext.cs

-6
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
using System;
2-
using System.Linq;
3-
using JetBrains.Annotations;
4-
using Microsoft.EntityFrameworkCore;
5-
using WeatherForecast.Entities;
6-
71
namespace WeatherForecast.Contexts;
82

93
[PublicAPI]

examples/WeatherForecast/src/WeatherForecast.Contexts/WeatherDataReadOnlyContext.cs

-9
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,3 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Threading.Tasks;
5-
using JetBrains.Annotations;
6-
using Microsoft.EntityFrameworkCore;
7-
using WeatherForecast.Entities;
8-
using WeatherForecast.Repositories;
9-
101
namespace WeatherForecast.Contexts;
112

123
[PublicAPI]

examples/WeatherForecast/src/WeatherForecast.Contexts/WeatherDataWriteOnlyContext.cs

-6
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
using System;
2-
using System.Threading.Tasks;
3-
using JetBrains.Annotations;
4-
using WeatherForecast.Entities;
5-
using WeatherForecast.Repositories;
6-
71
namespace WeatherForecast.Contexts;
82

93
[PublicAPI]

examples/WeatherForecast/src/WeatherForecast.Entities/HasId.cs

-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
using System;
2-
using System.ComponentModel.DataAnnotations;
3-
using System.Text.Json.Serialization;
4-
using JetBrains.Annotations;
5-
61
namespace WeatherForecast.Entities;
72

83
[PublicAPI]

examples/WeatherForecast/src/WeatherForecast.Entities/Temperature.cs

-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
using System;
2-
using System.Text.Json.Serialization;
3-
using JetBrains.Annotations;
4-
51
namespace WeatherForecast.Entities;
62

73
[PublicAPI]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
global using System;
2+
global using System.Collections.Generic;
3+
global using System.ComponentModel.DataAnnotations;
4+
global using System.Linq;
5+
global using System.Text.Json.Serialization;
6+
global using JetBrains.Annotations;

examples/WeatherForecast/src/WeatherForecast.Entities/WeatherData.cs

-6
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Text.Json.Serialization;
5-
using JetBrains.Annotations;
6-
71
namespace WeatherForecast.Entities;
82

93
[PublicAPI]

examples/WeatherForecast/src/WeatherForecast.Interactors/Error.cs

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
using JetBrains.Annotations;
2-
31
namespace WeatherForecast.Interactors;
42

53
[PublicAPI]

examples/WeatherForecast/src/WeatherForecast.Interactors/Failure.cs

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
using JetBrains.Annotations;
2-
31
namespace WeatherForecast.Interactors;
42

53
[PublicAPI]

examples/WeatherForecast/src/WeatherForecast.Interactors/Failure`1.cs

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
using JetBrains.Annotations;
2-
31
namespace WeatherForecast.Interactors;
42

53
[PublicAPI]

examples/WeatherForecast/src/WeatherForecast.Interactors/ICommand.cs

-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
using System.Threading.Tasks;
2-
using JetBrains.Annotations;
3-
41
namespace WeatherForecast.Interactors;
52

63
[PublicAPI]

examples/WeatherForecast/src/WeatherForecast.Interactors/INotifyInteractorResult.cs

-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
using System;
2-
using JetBrains.Annotations;
3-
41
namespace WeatherForecast.Interactors;
52

63
[PublicAPI]

examples/WeatherForecast/src/WeatherForecast.Interactors/ResultInfo.cs

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
using JetBrains.Annotations;
2-
31
namespace WeatherForecast.Interactors;
42

53
[PublicAPI]

examples/WeatherForecast/src/WeatherForecast.Interactors/ResultInfo`1.cs

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
using JetBrains.Annotations;
2-
31
namespace WeatherForecast.Interactors;
42

53
[PublicAPI]

examples/WeatherForecast/src/WeatherForecast.Interactors/SearchCityOrZipCode/ISearchCityOrZipCode.cs

-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
using System.Collections.Generic;
2-
using JetBrains.Annotations;
3-
using WeatherForecast.Entities;
4-
51
namespace WeatherForecast.Interactors.SearchCityOrZipCode;
62

73
[PublicAPI]

examples/WeatherForecast/src/WeatherForecast.Interactors/SearchCityOrZipCode/SearchCityOrZipCode.cs

-7
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Threading.Tasks;
4-
using JetBrains.Annotations;
5-
using WeatherForecast.Entities;
6-
using WeatherForecast.Repositories;
7-
81
namespace WeatherForecast.Interactors.SearchCityOrZipCode;
92

103
[PublicAPI]

examples/WeatherForecast/src/WeatherForecast.Interactors/StatusCode.cs

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
using JetBrains.Annotations;
2-
31
namespace WeatherForecast.Interactors;
42

53
[PublicAPI]

examples/WeatherForecast/src/WeatherForecast.Interactors/Success.cs

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
using JetBrains.Annotations;
2-
31
namespace WeatherForecast.Interactors;
42

53
[PublicAPI]

examples/WeatherForecast/src/WeatherForecast.Interactors/Success`1.cs

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
using JetBrains.Annotations;
2-
31
namespace WeatherForecast.Interactors;
42

53
[PublicAPI]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
global using System;
2+
global using System.Collections.Generic;
3+
global using System.Threading.Tasks;
4+
global using JetBrains.Annotations;
5+
global using WeatherForecast.Entities;
6+
global using WeatherForecast.Repositories;

examples/WeatherForecast/src/WeatherForecast.Repositories/IWeatherDataReadOnlyRepository.cs

-6
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Threading.Tasks;
4-
using JetBrains.Annotations;
5-
using WeatherForecast.Entities;
6-
71
namespace WeatherForecast.Repositories;
82

93
[PublicAPI]

examples/WeatherForecast/src/WeatherForecast.Repositories/IWeatherDataWriteOnlyRepository.cs

-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
using System.Threading.Tasks;
2-
using JetBrains.Annotations;
3-
using WeatherForecast.Entities;
4-
51
namespace WeatherForecast.Repositories;
62

73
[PublicAPI]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
global using System;
2+
global using System.Collections.Generic;
3+
global using System.Linq;
4+
global using System.Threading;
5+
global using System.Threading.Tasks;
6+
global using JetBrains.Annotations;
7+
global using WeatherForecast.Entities;

examples/WeatherForecast/src/WeatherForecast.Repositories/WeatherDataReadOnlyRepository.cs

+1-9
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,9 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Threading;
5-
using System.Threading.Tasks;
6-
using JetBrains.Annotations;
7-
using WeatherForecast.Entities;
8-
91
namespace WeatherForecast.Repositories;
102

113
[PublicAPI]
124
public sealed class WeatherDataReadOnlyRepository : IWeatherDataReadOnlyRepository
135
{
14-
private static readonly ThreadLocal<Random> Random = new(() => new Random());
6+
private static readonly ThreadLocal<Random> Random = new ThreadLocal<Random>(() => new Random());
157

168
public Task<IEnumerable<WeatherData>> GetAllAsync()
179
{

examples/WeatherForecast/src/WeatherForecast.Repositories/WeatherDataWriteOnlyRepository.cs

-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
using System;
2-
using System.Threading.Tasks;
3-
using JetBrains.Annotations;
4-
using WeatherForecast.Entities;
5-
61
namespace WeatherForecast.Repositories;
72

83
[PublicAPI]

examples/WeatherForecast/src/WeatherForecast/Controllers/WeatherForecastController.cs

-9
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,3 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Threading;
4-
using System.Threading.Tasks;
5-
using Microsoft.AspNetCore.Mvc;
6-
using WeatherForecast.Entities;
7-
using WeatherForecast.Interactors;
8-
using WeatherForecast.Interactors.SearchCityOrZipCode;
9-
101
namespace WeatherForecast.Controllers;
112

123
[Route("api/[controller]")]

examples/WeatherForecast/src/WeatherForecast/DatabaseContainer.cs

-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
using System.Threading;
2-
using System.Threading.Tasks;
3-
using Microsoft.Extensions.Hosting;
4-
using Testcontainers.SqlEdge;
5-
61
namespace WeatherForecast;
72

83
public sealed class DatabaseContainer : IHostedService

examples/WeatherForecast/src/WeatherForecast/Pages/SevenDayWeatherForecast.razor

+5-8
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
@using System.Collections.Immutable
2-
@using System.Collections.ObjectModel
3-
@using System.Globalization
4-
@using WeatherForecast.Entities
5-
@using WeatherForecast.Interactors
6-
@using WeatherForecast.Interactors.SearchCityOrZipCode
71
@implements IDisposable
82

93
@inject ISearchCityOrZipCode SearchCityOrZipCode
@@ -12,8 +6,11 @@
126
<div style="padding: 0 10px 10px">
137
<h1>Weather Forecast</h1>
148
<FluentDataGrid Items="@_weatherData.AsQueryable()">
15-
<PropertyColumn Title="Date" Property="@(item => item.Date.ToShortDateString())"/>
16-
<PropertyColumn Title="Avg °C" Property="@(item => item.Temperatures.Average(temperature => temperature.Value).ToString("0"))"/>
9+
<ChildContent>
10+
<PropertyColumn Title="Date" Property="@(item => item.Date.ToShortDateString())"/>
11+
<PropertyColumn Title="Avg °C" Property="@(item => item.Temperatures.Average(temperature => temperature.Value).ToString("0"))"/>
12+
</ChildContent>
13+
<EmptyContent></EmptyContent>
1714
</FluentDataGrid>
1815

1916
@{

examples/WeatherForecast/src/WeatherForecast/Pages/_Host.cshtml

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
@page "/"
2-
@using WeatherForecast
32
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
43

54
@{

examples/WeatherForecast/src/WeatherForecast/Program.cs

+6-13
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,8 @@
1-
using Microsoft.AspNetCore.Builder;
2-
using Microsoft.EntityFrameworkCore;
3-
using Microsoft.Extensions.Configuration;
4-
using Microsoft.Extensions.DependencyInjection;
5-
using Microsoft.Fast.Components.FluentUI;
6-
using WeatherForecast;
7-
using WeatherForecast.Contexts;
8-
using WeatherForecast.Interactors.SearchCityOrZipCode;
9-
using WeatherForecast.Repositories;
10-
111
var builder = WebApplication.CreateBuilder(args);
2+
builder.Services.AddFluentUIComponents();
3+
builder.Services.AddHttpClient();
124
builder.Services.AddRazorPages();
135
builder.Services.AddServerSideBlazor();
14-
builder.Services.AddHttpClient();
15-
builder.Services.AddFluentUIComponents();
166

177
var connectionString = builder.Configuration.GetConnectionString("DefaultConnection");
188

@@ -49,6 +39,9 @@
4939
app.MapFallbackToPage("/_Host");
5040
app.Run();
5141

52-
public sealed partial class Program
42+
namespace WeatherForecast
5343
{
44+
public sealed class Program
45+
{
46+
}
5447
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
global using System;
2+
global using System.Collections.Generic;
3+
global using System.Threading;
4+
global using System.Threading.Tasks;
5+
global using Microsoft.AspNetCore.Builder;
6+
global using Microsoft.AspNetCore.Mvc;
7+
global using Microsoft.EntityFrameworkCore;
8+
global using Microsoft.Extensions.Configuration;
9+
global using Microsoft.Extensions.DependencyInjection;
10+
global using Microsoft.Extensions.Hosting;
11+
global using Microsoft.Fast.Components.FluentUI;
12+
global using Testcontainers.SqlEdge;
13+
global using WeatherForecast;
14+
global using WeatherForecast.Contexts;
15+
global using WeatherForecast.Entities;
16+
global using WeatherForecast.Interactors;
17+
global using WeatherForecast.Interactors.SearchCityOrZipCode;
18+
global using WeatherForecast.Repositories;

examples/WeatherForecast/src/WeatherForecast/_Imports.razor

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
@using System.Collections.Immutable
2+
@using System.Collections.ObjectModel
3+
@using System.Globalization
14
@using System.Net.Http
25
@using Microsoft.AspNetCore.Authorization
36
@using Microsoft.AspNetCore.Components.Authorization
@@ -7,5 +10,7 @@
710
@using Microsoft.AspNetCore.Components.Web.Virtualization
811
@using Microsoft.Fast.Components.FluentUI
912
@using Microsoft.JSInterop
10-
@using WeatherForecast
13+
@using WeatherForecast.Entities
14+
@using WeatherForecast.Interactors
15+
@using WeatherForecast.Interactors.SearchCityOrZipCode
1116
@using WeatherForecast.Shared
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
global using System;
2+
global using System.Collections.Generic;
3+
global using System.Linq;
4+
global using System.Net;
5+
global using System.Net.Http;
6+
global using System.Text.Json;
7+
global using System.Threading.Tasks;
8+
global using JetBrains.Annotations;
9+
global using Microsoft.AspNetCore.Mvc.Testing;
10+
global using Microsoft.Extensions.DependencyInjection;
11+
global using Testcontainers.SqlEdge;
12+
global using WeatherForecast.Entities;
13+
global using WeatherForecast.Repositories;
14+
global using Xunit;

examples/WeatherForecast/tests/WeatherForecast.InProcess.Tests/WeatherForecastTest.cs

-15
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,3 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Net;
5-
using System.Net.Http;
6-
using System.Text.Json;
7-
using System.Threading.Tasks;
8-
using JetBrains.Annotations;
9-
using Microsoft.AspNetCore.Mvc.Testing;
10-
using Microsoft.Extensions.DependencyInjection;
11-
using Testcontainers.SqlEdge;
12-
using WeatherForecast.Entities;
13-
using WeatherForecast.Repositories;
14-
using Xunit;
15-
161
namespace WeatherForecast.InProcess.Tests;
172

183
[UsedImplicitly]

0 commit comments

Comments
 (0)