DJT.Vertical 8.3.2

There is a newer version of this package available.
See the version list below for details.
dotnet add package DJT.Vertical --version 8.3.2
                    
NuGet\Install-Package DJT.Vertical -Version 8.3.2
                    
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="DJT.Vertical" Version="8.3.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="DJT.Vertical" Version="8.3.2" />
                    
Directory.Packages.props
<PackageReference Include="DJT.Vertical" />
                    
Project file
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 DJT.Vertical --version 8.3.2
                    
#r "nuget: DJT.Vertical, 8.3.2"
                    
#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 DJT.Vertical@8.3.2
                    
#: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=DJT.Vertical&version=8.3.2
                    
Install as a Cake Addin
#tool nuget:?package=DJT.Vertical&version=8.3.2
                    
Install as a Cake Tool

DJT.Vertical

Vertical Slice architecture for Web APIs is an alternative to using controllers.

Using components

In your web application, include using DJT.Vertical.Http and call the following:


builder.Services.AddVerticalComponents();

var app = builder.Build();

app.UseVerticalComponents();

Service Attributes

Include the DJT.Vertical.Attributes namespace and start registering your dependency injected classes using the lifetime-named attributes. Each attribute also allows an optional key to be defined, therefore registering the class as a keyed service. For example:

[SingletonService(ImplementsType = typeof(IMyInterface),Key = "for_science")]
public class MySingletonService : IMyInterface
{
	public void DoSomething() 
	{
	}
}

[ScopedService]
public class MyScopedService ([FromKeyedServices("for_science")] IMyInterface singleton)
{
	public void DoSomethingElse()
	{
		singleton.DoSomething();
	}
}

Similarly, there is also a [TransientService] attribute.

Note: It is the assembly which calls directly AddVerticalComponents() which will be scanned for these attributes.

Request Handlers

Use the IRequestHandler<> interfaces to define the functionality of the API, using dependency injection for dependencies. I.e.

public class GetEmployeesHandler(MyDbContext db) : IRequestHandler<IEnumerably<Employees>>
{
	public IEnumerable<Employees> Execute()
	{
		return db.Employees.ToList();
	}
}

Async

Included in v8.1 are abstract classes for AsyncRequestHandler<> which require a cancellation token and obligate the return value wrapped in a Task<TRes>.

Exceptions

To return erroneous responses, use the included Exceptions, such as BadRequestException for a HTTP 400 response.

Custom response codes can be supplied using CustomStatusException.

Auth Service

A simple auth service for getting user claim information is included.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  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.
  • net8.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on DJT.Vertical:

Package Downloads
DJT.Vertical.AspNetCore

Helpful components for AspNetCore applications (particularly Web APIs) with vertical slice architecture.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
8.5.0 147 6/14/2025
8.4.1 155 4/30/2025
8.4.0 216 4/29/2025 8.4.0 is deprecated because it has critical bugs.
8.3.2 144 7/23/2024
8.3.1 146 3/25/2024
8.3.0 167 3/18/2024 8.3.0 is deprecated because it has critical bugs.
8.2.0 146 3/9/2024
8.0.0 152 2/18/2024