DynamicConsume 1.0.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package DynamicConsume --version 1.0.1                
NuGet\Install-Package DynamicConsume -Version 1.0.1                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="DynamicConsume" Version="1.0.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add DynamicConsume --version 1.0.1                
#r "nuget: DynamicConsume, 1.0.1"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install DynamicConsume as a Cake Addin
#addin nuget:?package=DynamicConsume&version=1.0.1

// Install DynamicConsume as a Cake Tool
#tool nuget:?package=DynamicConsume&version=1.0.1                

Dynamic Consume

Purpose

This package was prepared to eliminate the code confusion experienced when consuming the API in a .Net Core application.

Installation

You can add the package to your project via the Nuget package manager or cli

dotnet add package DynamicConsume --version 1.0.1

Usage

After installing the package, you must first register for the service in the Program.cs file.

builder.Services.AddDynamicConsume();

Afterwards, you can use it in the controller you will use by requesting it from the DI container. Example Usage:

 public class HomeController : Controller
    {

        private readonly Consume<WeatherDto> _consume;

        public HomeController(Consume<WeatherDto> consume)
        {
            _consume = consume;

        }
         public async Task<IActionResult> GetConsume()
        {
            var values = await _consume.GetListAsync("https://localhost:44367/WeatherForecast");
            var result = values;
            return View(values);
        }
    }
}

Example Usage 2:

 public class HomeController : Controller
    {

        private readonly Consume _consume1;

        public HomeController(Consume consume1)
        {
            _consume1 = consume1;
        }

        public async Task<IActionResult> GetString()
        {
            var values = await _consume1.GetStringAsync("https://localhost:44367/api/Values/GetString");
            var result = values;
            return View(values);
        }
    }
}

Development

License

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.0.1 103 6/17/2024
1.0.1 97 6/16/2024
1.0.0 98 6/16/2024