Overlap or restrictions http client NET 5.0, .NET Framework 4.8 & Mono

Muhammad Arsalan Iftikhar 6 Reputation points
2021-06-10T10:20:15.627+00:00

My current hobby project is a sdk that implements an open http protocol. I would like to cover a few runtimes, mainly NET5, Framework 4.8 and mono. Where possible cross-platform Another specific purifier is it makes a continous long polling call. The runtime diversity is mainly for learning purposes and to enable building a few different clients.

I have 2 questions.

Runtimes Are the specified runtimes too incompatible? I am mainly using http client and purosfully avoiding the new C# features. Models are in a net standard 2 library.

Http interface I created a wrapper for the http client, this is to initialize it properly and helps in a DI register function. The wrapper implements a custom http interface that is just a copy of put, post etc. For auth (JWT) I am using http messagehandler in DI.

Can I even use this typ of massage handler with a general interface across these runtimes? Some http clients differ ever so slightly in some places across runtimes. Next to that If I wanted to use blazor it could get weird with that http client.

I wanted to just put http clients in seperate projecs, add models proj to those and have a core sdk project dat references http clients depending on build. But my models cause a cyclic reference like that. The crossed out models folder in the sdk project is an internal models namespace.
104185-0rxo1.png

ASP.NET
ASP.NET
A set of technologies in the .NET Framework for building web applications and XML web services.
3,248 questions
C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,524 questions
.NET Runtime
.NET Runtime
.NET: Microsoft Technologies based on the .NET software framework.Runtime: An environment required to run apps that aren't compiled to machine language.
1,118 questions
{count} vote

1 answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 55,196 Reputation points
    2021-06-12T16:34:39.55+00:00

    Create your libraries as .net standard 2.0 projects. There is HttpClient and HttpMessageHandler support.

    The models project should not reference the http client library. Maybe you need 3 projects, models, communication, and interface.

    0 comments No comments