All Projects → davidrevoledo → Inyector

davidrevoledo / Inyector

Licence: MIT, Unknown licenses found Licenses found MIT LICENSE Unknown COPYING.txt
Library to Implement Automatic dependency injection by Configuration over Scaned Assemblies

Programming Languages

C#
18002 projects

Projects that are alternatives of or similar to Inyector

Firewall
ASP.NET Core middleware for IP address filtering.
Stars: ✭ 159 (+1123.08%)
Mutual labels:  aspnetcore, asp-net-core
Aspnetcoremultipleproject
ASP.NET Core API EF Core and Swagger
Stars: ✭ 189 (+1353.85%)
Mutual labels:  aspnetcore, asp-net-core
Netcorecms
NetCoreCMS is a modular theme supported Content Management System developed using ASP.Net Core 2.0 MVC. Which is also usable as web application framework. This project is still under development. Please do not use before it's first release.
Stars: ✭ 165 (+1169.23%)
Mutual labels:  aspnetcore, asp-net-core
Recaptcha.aspnetcore
Google reCAPTCHA v2/v3 for .NET Core 3.x
Stars: ✭ 122 (+838.46%)
Mutual labels:  aspnetcore, asp-net-core
MinimalApi
ASP.NET Core 7.0 - Minimal API Example - Todo API implementation using ASP.NET Core Minimal API, Entity Framework Core, Token authentication, Versioning, Unit Testing, Integration Testing and Open API.
Stars: ✭ 156 (+1100%)
Mutual labels:  aspnetcore, asp-net-core
Elmahcore
ELMAH for Net.Standard and Net.Core
Stars: ✭ 127 (+876.92%)
Mutual labels:  aspnetcore, asp-net-core
Aspnetcorelocalization
Localization.SqlLocalizer & ASP.NET Core MVC Localization Examples
Stars: ✭ 183 (+1307.69%)
Mutual labels:  aspnetcore, asp-net-core
Docker Series
Docker Series about containerizing ASP.NET Core app with MySQL..
Stars: ✭ 88 (+576.92%)
Mutual labels:  aspnetcore, asp-net-core
Hexagonal-architecture-ASP.NET-Core
App generator API solution template which is built on Hexagnonal Architecture with all essential feature using .NET Core
Stars: ✭ 57 (+338.46%)
Mutual labels:  aspnetcore, asp-net-core
SeoTags
SeoTags create all SEO tags you need such as meta, link, twitter card (twitter:), open graph (og:), and JSON-LD schema (structred data).
Stars: ✭ 113 (+769.23%)
Mutual labels:  aspnetcore, asp-net-core
Aspnetcore.identity.mongodbcore
A MongoDb UserStore and RoleStore adapter for Microsoft.AspNetCore.Identity 2.2. Allows you to use MongoDb instead of SQL server with Microsoft.AspNetCore.Identity 2.2. (not Identity 3.0)
Stars: ✭ 118 (+807.69%)
Mutual labels:  aspnetcore, asp-net-core
StartupModules
Startup modules for ASP.NET Core.
Stars: ✭ 33 (+153.85%)
Mutual labels:  aspnetcore, dependency-injection
Cronscheduler.aspnetcore
Cron Scheduler for AspNetCore 2.x/3.x or DotNetCore 2.x/3.x Self-hosted
Stars: ✭ 100 (+669.23%)
Mutual labels:  aspnetcore, asp-net-core
Formhelper
ASP.NET Core - Transform server-side validations to client-side without writing any javascript code. (Compatible with Fluent Validation)
Stars: ✭ 155 (+1092.31%)
Mutual labels:  aspnetcore, asp-net-core
Gitserver
ASP.NET Core Git HTTP Server
Stars: ✭ 98 (+653.85%)
Mutual labels:  aspnetcore, asp-net-core
Aspnetcore.identity.mongo
This is a MongoDB provider for the ASP.NET Core 2 Identity framework
Stars: ✭ 179 (+1276.92%)
Mutual labels:  aspnetcore, asp-net-core
Aspnetcore Tests Sample
A project to help demonstrate how to do unit, integration and acceptance tests with an web api project using ASP.NET Core and Angular 7 front end.
Stars: ✭ 40 (+207.69%)
Mutual labels:  aspnetcore, asp-net-core
Znetcs.aspnetcore.authentication.basic
A simple basic authentication middleware.
Stars: ✭ 40 (+207.69%)
Mutual labels:  aspnetcore, asp-net-core
Onion Architecture Asp.net Core
WhiteApp API solution template which is built on Onion Architecture with all essential feature using .NET 5!
Stars: ✭ 196 (+1407.69%)
Mutual labels:  aspnetcore, asp-net-core
Home
Home for Blazor Extensions
Stars: ✭ 51 (+292.31%)
Mutual labels:  aspnetcore, asp-net-core

Inyector

Inyector

What inyector is ?

Injector is a very simple tool that allow application that use Microsoft DI inyection to auto configure things.

This Library Is NOT a dependency injection engine.

It is simply an abstraction layer to configure our objects no matter what technology we use as an injection engine.

You can use Injector with your favorites libraries like Asp.Net Core DI, Autofac, Ninject and others ...

CodeFactor Build status NuGet NuGet License: MIT

Installation

Grab the latest Inyector NuGet package and install in your solution. https://www.nuget.org/packages/Inyector/

PM > Install-Package Inyector 
NET CLI - dotnet add package Inyector 
paket add Inyector --version 1.2

How to use

       -  Scan (Allow you to declare what assemblies Inyector need to listen to apply the rules, this is made to avoid processing all the referenced assmeblies)
           c.Scan(typeof(Startup).Assembly)
       - Modes 
       (The way to declare inyection engine without repeat code,
       you define a Mode with name an with an action that get both types)
           c.AddMode("MyCustomMode", (type, interf) => services.AddScoped(interf, type));
       - Rules
        You can apply any rule in an assembly or in all the shared scaned assemblies
        You can create your custom rules as well.
       
       - AddRuleForNamingConvention
       (You can auto-inyect all the objects that have the convention of Class and IClass (Interface) )
        
      -  AddRuleForEndsWithNamingConvention
       (You can auto-inyect all the objects that finish with a list of key values like "Helper" and "Factory" then
       if you have FooFactory and IFoo2Factory they can be auto-inyected)
       
       - AvoidInyectorAttribute you can avoid to apply any Inyector Rule
       with this attribute
       
       - InyectAttribute 
       with this attribute you can declare what object Inyector should auto-inyect
       You set the Interface and the Mode, if not Default will the mode (if exist) that apply to this Attribute
               [Inyect(typeof(IFooHelper))]
               public class CarHelper : IFooHelper
               {
               }
               [Inyect]
               public class CarHelper 
               {
               }
               [Inyect(typeof(IFooHelper), mode : "MyCustomMode")]
               public class CarHelper : IFooHelper
               {
               }

AspNetCore

PM > Install-Package Inyector-AspNetCore 	
NET CLI - dotnet add package Inyector-AspNetCore 

With AspNet core you can avoid to configure modes, using the ServiceLifetime Enum to apply pre-builded Modes, Also you can define your owns.

        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddMvc();

            // use injector
            services.UseInjector(configurations =>
            {
                configurations.Scan(typeof(Startup).Assembly)
                    .DefaultMode(services, ServiceLifetime.Singleton)
                    .AddRuleForNamingConvention(ServiceLifetime.Singleton);
            });
        }

Raw

To use injector directly you have call C# InyectorStartup class like this :

InyectorStartup.Init(c =>
            {
                c.Scan(typeof(AnyClass).Assembly)
                    .AddRuleForNamingConvention((type, interf) => services.AddSingleton(interf, type))
                    .AddRule((type, inter)=> services.RegisterType(inter, type));
            });

Licensing

Inyector is licensed under the MIT License

Development

Want to contribute? Great!

Made with in DGENIX

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].