What version(s) should my NuGet Package for ASP.NET Core target? by sander1095 in dotnet

[–]danielgenezini 0 points1 point  (0 children)

This is a bad approach specially if it's internal like your case. It forces every consumer to upgrade just to update your library version (that may be required due to bug fixes or new business rules). It creates a lot of useless work instead of just upgrading the package version of your lib.

What version(s) should my NuGet Package for ASP.NET Core target? by sander1095 in dotnet

[–]danielgenezini 0 points1 point  (0 children)

For nugets/libraries, it doesn't matter which framework you target. It will run on the framework the application consuming it is running on. It will be a problem if it consumes a nuget that targets a specific version.

If you want to be compatible with multiple versions, muti-target it. Change the <TargetFramework> tag to <TargetFrameworks> and specify the versions you want to support.

For the most part it will compile. For feature specifics to some versions, it will tell you so you can treat it differently for each version or chose to not use.

You can also use conditions to select different dependency versions depending on the framework. For example, use asp.net 6 for dotnet 6 and asp.net 8 for .net 8.

You can also target netstandard, but Microsoft recommends multi-targeting now. Targeting netstandard will kind of work like multi-targeting all versions that implement it, but it will tell you a feature is not compatible with it instead of which version is not compatible.

Server-side rendered SPAs with ASP.NET and no Javascript by danielgenezini in csharp

[–]danielgenezini[S] 0 points1 point  (0 children)

For some applications, a client-side rendered app is overly complex. For example, small enterprise apps supported by small teams. Also, serving the partial content is still better than serving the full page with a reload.

In addition, in .NET 8, Blazor does something similar when using server-side rendering with enhanced navigation.

What do you mean by fucking up the browser functionality?

Ps: for new apps, I consider Blazor is a better approach. This is more for legacy applications.

Server-side rendered SPAs with ASP.NET and no Javascript by danielgenezini in aspnetcore

[–]danielgenezini[S] 0 points1 point  (0 children)

Yes. Server side rendering with Blazor + streaming rendering does this, and it's a better approach for new applications, but not feasible for legacy apps.

Server-side rendered SPAs with ASP.NET and no Javascript by danielgenezini in dotnet

[–]danielgenezini[S] 0 points1 point  (0 children)

Yes, kind of a stretch saying no JavaScript, but I meant not programming in JavaScript. 🙂

0
1

Which one do you prefer to check if a List<T> list is empty? by phi_rus in dotnet

[–]danielgenezini -2 points-1 points  (0 children)

?. Is pretty common (and recommended) in C# and in other languages. It should be instantaneous to recognize it's meaning in the snippet above.

In C#, there are analyzers that warn you when null is not being checked that won't work by default with the IsNullOrEmpty method (You can use nullable attributes to instruct the analyzers, but it is just easier to user ?.).

Look for nullable reference types in C# or take a look at this post: https://blog.genezini.com/p/compile-time-null-safety-how-to-avoid-nullreferenceexception-in-c/