Skip to content

Commit

Permalink
refactor: Move usings to global file
Browse files Browse the repository at this point in the history
  • Loading branch information
HofmeisterAn committed Oct 15, 2023
1 parent db16f85 commit dfbaef6
Show file tree
Hide file tree
Showing 40 changed files with 102 additions and 182 deletions.
8 changes: 4 additions & 4 deletions examples/WeatherForecast/Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
<Project>
<ItemGroup>
<PackageReference Update="JetBrains.Annotations" Version="2023.2.0" PrivateAssets="all"/>
<PackageReference Update="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.21"/>
<PackageReference Update="Microsoft.EntityFrameworkCore" Version="6.0.21"/>
<PackageReference Update="Microsoft.Fast.Components.FluentUI" Version="3.0.1"/>
<PackageReference Update="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.23"/>
<PackageReference Update="Microsoft.EntityFrameworkCore" Version="6.0.23"/>
<PackageReference Update="Microsoft.Fast.Components.FluentUI" Version="3.2.0"/>
<PackageReference Update="Testcontainers.SqlEdge" Version="3.5.0"/>
<PackageReference Update="System.ComponentModel.Annotations" Version="5.0.0"/>
<PackageReference Update="System.Text.Json" Version="6.0.8"/>
<PackageReference Update="Microsoft.AspNetCore.Mvc.Testing" Version="6.0.21"/>
<PackageReference Update="Microsoft.AspNetCore.Mvc.Testing" Version="6.0.23"/>
<PackageReference Update="Microsoft.NET.Test.Sdk" Version="17.7.2"/>
<PackageReference Update="Selenium.WebDriver.ChromeDriver" Version="106.0.5249.6100"/>
<PackageReference Update="Selenium.WebDriver" Version="4.9.1"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
global using System;
global using System.Collections.Generic;
global using System.Linq;
global using System.Threading.Tasks;
global using JetBrains.Annotations;
global using Microsoft.EntityFrameworkCore;
global using WeatherForecast.Entities;
global using WeatherForecast.Repositories;
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
using System;
using System.Linq;
using JetBrains.Annotations;
using Microsoft.EntityFrameworkCore;
using WeatherForecast.Entities;

namespace WeatherForecast.Contexts;

[PublicAPI]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,3 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using JetBrains.Annotations;
using Microsoft.EntityFrameworkCore;
using WeatherForecast.Entities;
using WeatherForecast.Repositories;

namespace WeatherForecast.Contexts;

[PublicAPI]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
using System;
using System.Threading.Tasks;
using JetBrains.Annotations;
using WeatherForecast.Entities;
using WeatherForecast.Repositories;

namespace WeatherForecast.Contexts;

[PublicAPI]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.Text.Json.Serialization;
using JetBrains.Annotations;

namespace WeatherForecast.Entities;

[PublicAPI]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
using System;
using System.Text.Json.Serialization;
using JetBrains.Annotations;

namespace WeatherForecast.Entities;

[PublicAPI]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
global using System;
global using System.Collections.Generic;
global using System.ComponentModel.DataAnnotations;
global using System.Linq;
global using System.Text.Json.Serialization;
global using JetBrains.Annotations;
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.Json.Serialization;
using JetBrains.Annotations;

namespace WeatherForecast.Entities;

[PublicAPI]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
using JetBrains.Annotations;

namespace WeatherForecast.Interactors;

[PublicAPI]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
using JetBrains.Annotations;

namespace WeatherForecast.Interactors;

[PublicAPI]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
using JetBrains.Annotations;

namespace WeatherForecast.Interactors;

[PublicAPI]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
using System.Threading.Tasks;
using JetBrains.Annotations;

namespace WeatherForecast.Interactors;

[PublicAPI]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
using System;
using JetBrains.Annotations;

namespace WeatherForecast.Interactors;

[PublicAPI]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
using JetBrains.Annotations;

namespace WeatherForecast.Interactors;

[PublicAPI]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
using JetBrains.Annotations;

namespace WeatherForecast.Interactors;

[PublicAPI]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
using System.Collections.Generic;
using JetBrains.Annotations;
using WeatherForecast.Entities;

namespace WeatherForecast.Interactors.SearchCityOrZipCode;

[PublicAPI]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using JetBrains.Annotations;
using WeatherForecast.Entities;
using WeatherForecast.Repositories;

namespace WeatherForecast.Interactors.SearchCityOrZipCode;

[PublicAPI]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
using JetBrains.Annotations;

namespace WeatherForecast.Interactors;

[PublicAPI]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
using JetBrains.Annotations;

namespace WeatherForecast.Interactors;

[PublicAPI]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
using JetBrains.Annotations;

namespace WeatherForecast.Interactors;

[PublicAPI]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
global using System;
global using System.Collections.Generic;
global using System.Threading.Tasks;
global using JetBrains.Annotations;
global using WeatherForecast.Entities;
global using WeatherForecast.Repositories;
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using JetBrains.Annotations;
using WeatherForecast.Entities;

namespace WeatherForecast.Repositories;

[PublicAPI]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
using System.Threading.Tasks;
using JetBrains.Annotations;
using WeatherForecast.Entities;

namespace WeatherForecast.Repositories;

[PublicAPI]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
global using System;
global using System.Collections.Generic;
global using System.Linq;
global using System.Threading;
global using System.Threading.Tasks;
global using JetBrains.Annotations;
global using WeatherForecast.Entities;
Original file line number Diff line number Diff line change
@@ -1,17 +1,9 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using JetBrains.Annotations;
using WeatherForecast.Entities;

namespace WeatherForecast.Repositories;

[PublicAPI]
public sealed class WeatherDataReadOnlyRepository : IWeatherDataReadOnlyRepository
{
private static readonly ThreadLocal<Random> Random = new(() => new Random());
private static readonly ThreadLocal<Random> Random = new ThreadLocal<Random>(() => new Random());

public Task<IEnumerable<WeatherData>> GetAllAsync()
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
using System;
using System.Threading.Tasks;
using JetBrains.Annotations;
using WeatherForecast.Entities;

namespace WeatherForecast.Repositories;

[PublicAPI]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,3 @@
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using WeatherForecast.Entities;
using WeatherForecast.Interactors;
using WeatherForecast.Interactors.SearchCityOrZipCode;

namespace WeatherForecast.Controllers;

[Route("api/[controller]")]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Hosting;
using Testcontainers.SqlEdge;

namespace WeatherForecast;

public sealed class DatabaseContainer : IHostedService
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
@using System.Collections.Immutable
@using System.Collections.ObjectModel
@using System.Globalization
@using WeatherForecast.Entities
@using WeatherForecast.Interactors
@using WeatherForecast.Interactors.SearchCityOrZipCode
@implements IDisposable

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

@{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
@page "/"
@using WeatherForecast
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers

@{
Expand Down
19 changes: 6 additions & 13 deletions examples/WeatherForecast/src/WeatherForecast/Program.cs
Original file line number Diff line number Diff line change
@@ -1,18 +1,8 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Fast.Components.FluentUI;
using WeatherForecast;
using WeatherForecast.Contexts;
using WeatherForecast.Interactors.SearchCityOrZipCode;
using WeatherForecast.Repositories;

var builder = WebApplication.CreateBuilder(args);
builder.Services.AddFluentUIComponents();
builder.Services.AddHttpClient();
builder.Services.AddRazorPages();
builder.Services.AddServerSideBlazor();
builder.Services.AddHttpClient();
builder.Services.AddFluentUIComponents();

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

Expand Down Expand Up @@ -49,6 +39,9 @@
app.MapFallbackToPage("/_Host");
app.Run();

public sealed partial class Program
namespace WeatherForecast
{
public sealed class Program
{
}
}
18 changes: 18 additions & 0 deletions examples/WeatherForecast/src/WeatherForecast/Usings.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
global using System;
global using System.Collections.Generic;
global using System.Threading;
global using System.Threading.Tasks;
global using Microsoft.AspNetCore.Builder;
global using Microsoft.AspNetCore.Mvc;
global using Microsoft.EntityFrameworkCore;
global using Microsoft.Extensions.Configuration;
global using Microsoft.Extensions.DependencyInjection;
global using Microsoft.Extensions.Hosting;
global using Microsoft.Fast.Components.FluentUI;
global using Testcontainers.SqlEdge;
global using WeatherForecast;
global using WeatherForecast.Contexts;
global using WeatherForecast.Entities;
global using WeatherForecast.Interactors;
global using WeatherForecast.Interactors.SearchCityOrZipCode;
global using WeatherForecast.Repositories;
7 changes: 6 additions & 1 deletion examples/WeatherForecast/src/WeatherForecast/_Imports.razor
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
@using System.Collections.Immutable
@using System.Collections.ObjectModel
@using System.Globalization
@using System.Net.Http
@using Microsoft.AspNetCore.Authorization
@using Microsoft.AspNetCore.Components.Authorization
Expand All @@ -7,5 +10,7 @@
@using Microsoft.AspNetCore.Components.Web.Virtualization
@using Microsoft.Fast.Components.FluentUI
@using Microsoft.JSInterop
@using WeatherForecast
@using WeatherForecast.Entities
@using WeatherForecast.Interactors
@using WeatherForecast.Interactors.SearchCityOrZipCode
@using WeatherForecast.Shared
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
global using System;
global using System.Collections.Generic;
global using System.Linq;
global using System.Net;
global using System.Net.Http;
global using System.Text.Json;
global using System.Threading.Tasks;
global using JetBrains.Annotations;
global using Microsoft.AspNetCore.Mvc.Testing;
global using Microsoft.Extensions.DependencyInjection;
global using Testcontainers.SqlEdge;
global using WeatherForecast.Entities;
global using WeatherForecast.Repositories;
global using Xunit;
Original file line number Diff line number Diff line change
@@ -1,18 +1,3 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Text.Json;
using System.Threading.Tasks;
using JetBrains.Annotations;
using Microsoft.AspNetCore.Mvc.Testing;
using Microsoft.Extensions.DependencyInjection;
using Testcontainers.SqlEdge;
using WeatherForecast.Entities;
using WeatherForecast.Repositories;
using Xunit;

namespace WeatherForecast.InProcess.Tests;

[UsedImplicitly]
Expand Down
Loading

0 comments on commit dfbaef6

Please sign in to comment.