Prashant.AutoServiceInjection 6.0.2

There is a newer version of this package available.
See the version list below for details.
dotnet add package Prashant.AutoServiceInjection --version 6.0.2                
NuGet\Install-Package Prashant.AutoServiceInjection -Version 6.0.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="Prashant.AutoServiceInjection" Version="6.0.2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Prashant.AutoServiceInjection --version 6.0.2                
#r "nuget: Prashant.AutoServiceInjection, 6.0.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.
// Install Prashant.AutoServiceInjection as a Cake Addin
#addin nuget:?package=Prashant.AutoServiceInjection&version=6.0.2

// Install Prashant.AutoServiceInjection as a Cake Tool
#tool nuget:?package=Prashant.AutoServiceInjection&version=6.0.2                

AutoServiceInjection

A automated service injection for DotNet.

Supported

Tested on .Net6 Only .Net6,.Net5 is supported.

Architectural pattern

There are two ways of performing automated dependency injections.

  1. old style, where service is explicitly marked to interface with service type to do dependency injection.
  2. New Style, where interface is marked with contact and service is marked with serivce type.

New style of standard implies one to one model where a single contract can only have a single service. In this model, the development of a project will faster and quicker. Perfer new style.

New style

In Program.cs

var builder = WebApplication.CreateBuilder(args);
...
...
builder.Services.AutoRegisterServices();  // Add this to enable Auto Dependencies injection. By default old style is disabled.
...
...

Service model

using System;

[Service(ServiceType.Transient)]
public class TheDemoService : IDemo

contract model

using System;

[Contract]
public interface IDemo

Old Style

To enable old style in .Net 6 and .Net 5

builder.Services.AutoRegisterServices(opt => {
    opt.EnableBackwardCompatibility = true;
});
using Prashant.AutoServiceInjection;

[Service(typeof(IDemo),ServiceType.Transient)]
public class TheDemoService : IDemo

In startup.cs

using Prashant.AutoServiceInjection;

public void ConfigureServices(IServiceCollection services)
{
    ....
    ....
    Service.AutoRegister(services,true); //That's all
}

For issues and Sugguestions

Ping me @ https://twitter.com/Prashant_Elango or Drop a mail to software-devision@froze.in

Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  net6.0 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
6.0.3 446 5/29/2022
6.0.2 441 5/9/2022
6.0.1 418 5/8/2022
6.0.0 427 4/27/2022
1.0.2 409 6/28/2021
1.0.1 613 6/28/2021 1.0.1 is deprecated because it is no longer maintained.
1.0.0 319 6/28/2021