Dosaic.Hosting.Generator
1.0.18
See the version list below for details.
dotnet add package Dosaic.Hosting.Generator --version 1.0.18
NuGet\Install-Package Dosaic.Hosting.Generator -Version 1.0.18
<PackageReference Include="Dosaic.Hosting.Generator" Version="1.0.18" />
paket add Dosaic.Hosting.Generator --version 1.0.18
#r "nuget: Dosaic.Hosting.Generator, 1.0.18"
// Install Dosaic.Hosting.Generator as a Cake Addin #addin nuget:?package=Dosaic.Hosting.Generator&version=1.0.18 // Install Dosaic.Hosting.Generator as a Cake Tool #tool nuget:?package=Dosaic.Hosting.Generator&version=1.0.18
Dosaic.Hosting.Generator
Dosaic.Hosting.Generator is a dotnet source generator package
that allows dotnet dev's
to use the dosaic web host to discover available dosaic plugins
.
Installation
To install the nuget package follow these steps:
dotnet add package Dosaic.Hosting.Generator # this is required so the web host can discover & load the plugins
dotnet add package Dosaic.Hosting.WebHost
or add as package reference to your .csproj
<PackageReference Include="Dosaic.Hosting.Generator" Version="" />
<PackageReference Include="Dosaic.Hosting.WebHost" Version="" />
Concept
The source generator will scan all assemblies which are referenced by the Dosaic.Hosting.Webhost project and add any classes or interfaces which are implementing
- the interface
IPluginActivateable
- any class attribute which starts with the name
Dosaic
to generate a class like the following example
using System;
using System.Diagnostics.CodeAnalysis;
using System.CodeDom.Compiler;
namespace Dosaic.Generated;
[ExcludeFromCodeCoverage]
[GeneratedCode("Dosaic.Hosting.Generator", "0.5.0.0")]
public class DosaicPluginTypes {
public static Type[] All = new Type[] {
typeof(Dosaic.Hosting.WebHost.Sample.HangfireTestJob),
typeof(Dosaic.Hosting.WebHost.Sample.WebHostSamplePlugin),
typeof(Dosaic.Hosting.WebHost.Sample.NpgsqlDbConfiguration),
typeof(Dosaic.Api.OpenApi.OpenApiConfiguration),
typeof(Dosaic.Api.OpenApi.OpenApiPlugin),
typeof(Dosaic.Plugins.Authorization.Keycloak.KeycloakPlugin),
typeof(Dosaic.Plugins.Authorization.Keycloak.KeycloakPluginConfiguration),
typeof(Dosaic.Plugins.Endpoints.RestResourceEntity.RestResourceEntityPlugin),
typeof(Dosaic.Plugins.Jobs.Hangfire.HangfireConfiguration),
typeof(Dosaic.Plugins.Jobs.Hangfire.HangFirePlugin),
typeof(Dosaic.Plugins.Persistence.EntityFramework.EntityFrameworkPlugin),
typeof(Dosaic.Hosting.Abstractions.Middlewares.ExceptionMiddleware),
typeof(Dosaic.Hosting.Abstractions.Middlewares.RequestContentLengthLimitMiddleware),
typeof(Dosaic.Plugins.Handlers.Cqrs.SimpleResource.CqrsSimpleResourcePlugin),
};
}
This class then gets referenced by the webhost's Program.cs e.g.
If you don't include the generator package, you must specify the allowed plugin types manually!
using Dosaic.Hosting.WebHost;
PluginWebHostBuilder.RunDefault(Dosaic.Generated.DosaicPluginTypes.All);
The webhost's service-, host- and application-configurators then access this list of types to activate and load all the found plugins on startup.
Excludes
The following namespaces will be ignored when the source generator goes through all the assemblies at build time:
- Microsoft
- System
- FastEndpoints
- testhost
- netstandard
- Newtonsoft
- mscorlib
- NuGet
- NSwag
- FluentValidation
- YamlDotNet
- Accessibility
- NJsonSchema
- Namotion"
Changes to this list may happen in the future based on new requirements.
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. 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. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- 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.