Morris.Roslynject
0.1.0
Prefix Reserved
The owner has unlisted this package.
This could mean that the package is deprecated, has security vulnerabilities or shouldn't be used anymore.
dotnet add package Morris.Roslynject --version 0.1.0
NuGet\Install-Package Morris.Roslynject -Version 0.1.0
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="Morris.Roslynject" Version="0.1.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Morris.Roslynject" Version="0.1.0" />
<PackageReference Include="Morris.Roslynject" />
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 Morris.Roslynject --version 0.1.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Morris.Roslynject, 0.1.0"
#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 Morris.Roslynject@0.1.0
#: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=Morris.Roslynject&version=0.1.0
#tool nuget:?package=Morris.Roslynject&version=0.1.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Roslynject
Roslynject is
- Reflection-free
- Dependency discovery
- Registration by convention library for C#
Purpose
The purpose of Roslynject is to move dependency registration to where it belongs, into each project that declares dependencies.
Declaring these dependencies manually is time consuming and prone to errors. Roslynject allows you to declare conventions and then uses Roslyn code-generation to create the registration code for you.
Getting started
- Add a reference to the package
Morris.Roslynjectto your project. - Create your interfaces / classes.
public interface IPaymentStragegy {}
public class Strategy1 : IPaymentStrategy {}
public class Strategy2 : IPaymentStrategy {}
public class Strategy3 : IPaymentStrategy {}
- Create your registration class and decorate it with one or more
[Roslynject]attributes to define the registrations you require.
[Roslynject(
Find.AnyTypeOf,
typeof(IPaymentStrategy),
Register.BaseType,
WithLifetime.Scoped]
public partial class MyAppServices
{
}
- Call
MyAppServices.RegisterServices(IServiceCollection)to register the discovered services.
Examples
Click here to view usage.
There are no supported framework assets in this package.
Learn more about Target Frameworks and .NET Standard.
-
.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.
| Version | Downloads | Last Updated |
|---|