Grad.CsLib
2.0.12
dotnet add package Grad.CsLib --version 2.0.12
NuGet\Install-Package Grad.CsLib -Version 2.0.12
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="Grad.CsLib" Version="2.0.12" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Grad.CsLib" Version="2.0.12" />
<PackageReference Include="Grad.CsLib" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Grad.CsLib --version 2.0.12
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Grad.CsLib, 2.0.12"
#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.
#:package Grad.CsLib@2.0.12
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Grad.CsLib&version=2.0.12
#tool nuget:?package=Grad.CsLib&version=2.0.12
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
CsLib Core Package
This package contains utilities for C# API projects.
This package is very opinionated, as it's intended for Graduate College API projects:
- FastEndpoints is used, which is a thin layer on top of .NET Core minimal APIs.
- OpenAPI/Swagger docs are generated from endpoint definitions and XML documentation.
The JSON is exported to the
/specfolder for generating client libraries.- Kiota is used to generate the OpenAPI JSON, but not the client libraries.
- Authentication is through Entra.
Requirements
- .NET Core 10
Dependencies
Outside of Microsoft packages, these are the main dependencies:
CsLibWeb
Here's an example of how to set up a Program.cs file for a web API project:
using ExampleData;
using ExampleServer;
using FastEndpoints.ClientGen.Kiota;
using Grad.CsLib;
using Microsoft.EntityFrameworkCore;
using Serilog;
var builder = WebApplication.CreateBuilder(args);
builder.AddSwagger(args, "ExampleServer", "0.0.1", "Example Backend Server");
builder
.AddSerilog()
.AddCors()
.AddAuth();
builder.Services
.AddDbContext<ExampleContext>(options =>
options.UseSqlServer(
builder.Configuration.GetConnectionString("Example")))
.AddAuthorization(AuthPolicy.AddAuthPolicy)
.RegisterServicesFromExampleServer();
builder.AddEndpoints(DiscoveredTypes.All);
try
{
var app = builder.BuildAndConfigureApp(b => b.ReflectionCache.AddFromExampleData().AddFromExampleServer());
// This is only run with the --exportswaggerjson option
await app.ExportSwaggerJsonAndExitAsync("ExampleServer", "../spec");
app.Run();
}
catch (Exception ex)
{
Log.Fatal(ex, "Application start-up failed");
}
finally
{
Log.CloseAndFlush();
}
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net10.0
- FastEndpoints (>= 7.2.0)
- FastEndpoints.ClientGen.Kiota (>= 7.2.0)
- FastEndpoints.Security (>= 7.2.0)
- FastEndpoints.Swagger (>= 7.2.0)
- Microsoft.AspNetCore.Authentication.JwtBearer (>= 10.0.2)
- Microsoft.AspNetCore.Authentication.OpenIdConnect (>= 10.0.2)
- Microsoft.AspNetCore.OpenApi (>= 10.0.2)
- Microsoft.Identity.Web (>= 4.3.0)
- Microsoft.Identity.Web.DownstreamApi (>= 4.3.0)
- Microsoft.OpenApi.ApiManifest (>= 2.0.0-preview5)
- Microsoft.OpenApi.Kiota.Builder (>= 1.29.0)
- Riok.Mapperly (>= 4.3.1)
- Serilog (>= 4.3.0)
- Serilog.AspNetCore (>= 10.0.0)
- Serilog.Sinks.Console (>= 6.1.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.