EasyAPICore 1.0.3
dotnet add package EasyAPICore --version 1.0.3
NuGet\Install-Package EasyAPICore -Version 1.0.3
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="EasyAPICore" Version="1.0.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add EasyAPICore --version 1.0.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: EasyAPICore, 1.0.3"
#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 EasyAPICore as a Cake Addin
#addin nuget:?package=EasyAPICore&version=1.0.3
// Install EasyAPICore as a Cake Tool
#tool nuget:?package=EasyAPICore&version=1.0.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
EasyAPICore
The Controller API is automatically generated by convention
Simplest Usage
Create ASP.NET Core WebApi(Or MVC) Project
dotnet new webapi -o SampleWebAPI
Install components via .Net CLI
dotnet add package EasyAPICore --version 1.0.3
Add new SampleService
using EasyAPICore; using Microsoft.AspNetCore.Mvc; using System; namespace SampleWebAPI { public class SampleService : IEasyAPI { public BookReadDto Create(BookDto book) { return new BookReadDto { Id = new Random().Next(1, 100), Name = book.Name, Description = book.Description }; } public string Get(int id) { var dto = new BookReadDto { Id = id, Name = "Three body", Description = "The Trisolaran Dark Forest" }; return dto.ToString(); } public string Delete(int id) { var dto = new BookReadDto { Id = id, Name = "Three body", Description = "The Trisolaran Dark Forest" }; return $"Delete {dto.ToString()} Success!" ; } } public class BookDto { /// <summary> /// Book Name /// </summary> public string Name { get; set; } /// <summary> /// Book Description /// </summary> public string Description { get; set; } } public class BookReadDto { /// <summary> /// Book Id /// </summary> public int Id { get; set; } /// <summary> /// Book Name /// </summary> public string Name { get; set; } /// <summary> /// Book Description /// </summary> public string Description { get; set; } public override string ToString() { return $"Book ID:{Id},Book Name:{Name},Book Description:{Description}"; } } }
Registered EasyAPICore
public void ConfigureServices(IServiceCollection services) { //Register Swagger services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new OpenApiInfo { Title = "SampleWebAPI", Version = "v1" }); //Must Add this c.DocInclusionPredicate((docName, description) => true); }); services.AddEasyAPICore(); }
Add Middleware EasyAPICore
app.UseEasyAPICore();
Run Sample
dotnet run
If you have any comments or suggestions, please contact me or add issue for me.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. 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. |
.NET Core | netcoreapp3.1 is compatible. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETCoreApp 3.1
- No dependencies.
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 |
---|---|---|
1.0.3 | 301 | 12/9/2022 |
The Controller API is automatically generated by convention