Autofac.EasyPropInject 1.1.1

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

// Install Autofac.EasyPropInject as a Cake Tool
#tool nuget:?package=Autofac.EasyPropInject&version=1.1.1                

Autofac.EasyPropInject

An extension i created to make it possible to to inject properties by attribute, without any other helper libs in .NET Core for Autofac.

Important

This Branch is inactive besides minor fixes. We recommend to update your Autofac Dependency to 6.x. Autofac.EasyPropInject 1.1.x supports Autofac 5.14+ up to 5.2.x. Autofac 6.x Users please have a look at branch master and 1.2.x Autofac 3.x, 4.x Users please have a look at branch 1.0.x.

Install

Nuget

Install-Package Autofac.EasyPropInject

DotNetCli

dotnet add package Autofac.EasyPropInject

Usage

Startup.cs

Go to "ConfigureServices" Make sure that you create the Autofac Container as usual for your Framework (Supported is .NET CORE 2.x) like its described here: https://autofac.readthedocs.io/en/latest/integration/index.html

and then you create the instance BEFORE any registration.

   public IServiceProvider ConfigureServices(IServiceCollection services)
   {
          ......
          var builder = new ContainerBuilder().AddEasyPropInject();
          
          //Add you services now as usual 
    }
    

Usage in the Code

using Autofac.EasyPropInject.Annotations;
public class MyClass:IMyInterface 
{ 
    public MyClass(ISomeOtherInterface someService) 
    { 
      
    }
    
    [FromAutofac]
    public IUnitOfWork unit { get;set; }
}

After "MyClass" is activated by autofac, "IUnitOfWork unit" will be resolved and set to the property.

Product 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. 
.NET Core netcoreapp3.1 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETCoreApp 3.1

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.