Skip to content

Improvements/implicit usings#582

Merged
KrzysztofPajak merged 3 commits intograndnode:mainfrom
GuyPago:improvements/implicit-usings
Mar 3, 2025
Merged

Improvements/implicit usings#582
KrzysztofPajak merged 3 commits intograndnode:mainfrom
GuyPago:improvements/implicit-usings

Conversation

@GuyPago
Copy link
Copy Markdown
Contributor

@GuyPago GuyPago commented Mar 1, 2025

Resolves #issueNumber
Type: improvements

Issue

Grand.Common.props should be as clean as possible. It manualy adds common namespaces as global, while .NET 6 provided a cleaner, built in way to do so.

Solution

Add UseGlobalUsings which behaves differently across different SDKs. e.g for Web environment:

Grand.Web.GlobalUsings.g.cs

// <auto-generated/>
global using global::Microsoft.AspNetCore.Builder;
global using global::Microsoft.AspNetCore.Hosting;
global using global::Microsoft.AspNetCore.Http;
global using global::Microsoft.AspNetCore.Routing;
global using global::Microsoft.Extensions.Configuration;
global using global::Microsoft.Extensions.DependencyInjection;
global using global::Microsoft.Extensions.Hosting;
global using global::Microsoft.Extensions.Logging;
global using global::System;
global using global::System.Collections.Generic;
global using global::System.IO;
global using global::System.Linq;
global using global::System.Net.Http;
global using global::System.Net.Http.Json;
global using global::System.Text;
global using global::System.Threading;
global using global::System.Threading.Tasks;

Breaking changes

Testing

@GuyPago
Copy link
Copy Markdown
Contributor Author

GuyPago commented Mar 1, 2025

@KrzysztofPajak Do you want me to add another commit that removes unused imports across the project that resulted from this PR?

Comment thread src/Build/Grand.Common.props
@GuyPago GuyPago force-pushed the improvements/implicit-usings branch from b7ca9ee to 1d6f4d9 Compare March 1, 2025 12:48
@KrzysztofPajak
Copy link
Copy Markdown
Member

There will probably be a lot of files, let's leave it as it is

@KrzysztofPajak KrzysztofPajak merged commit c069d60 into grandnode:main Mar 3, 2025
szjanikowski pushed a commit to NoesisVision/grandnode2 that referenced this pull request May 8, 2025
* Use implicit usings and remove manual global usings
* Explicitly use `Grand.Infrastructure.StartupBase`
* Slightly re-order `Grand.Common.props`
---------
Co-authored-by: Guy Taggar <guypago@outlook.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants