Showing posts with label Dependency Injection. Show all posts
Showing posts with label Dependency Injection. Show all posts

Sunday, August 9, 2015

DEPENDENCY INJECTION IN ASP.NET VNEXT

Microsoft changed the way how dependency injection (DI) is done in ASP.NET vNext. In previous versions of ASP.NET there were different entry points for user defined classes like the IControllerFactory for ASP.NET MVC applications or the IHttpControllerActivator for ASP.NET WebAPI applications. Starting with ASP.NET vNext DI becomes a first-class citizen in the framework through the whole stack. With showing the new DI features in ASP.NET vNext, discussions came up whether it is the correct way to do DI. In this post I like to show how DI works in ASP.NET vNext and then lead to the current discussion about it. At the end I like to ask you for your opinion.


I guess you came to this post by searching similar kind of issues in any of the search engine and hope that this resolved your problem. If you find this tips useful, just drop a line below and share the link to others and who knows they might find it useful too.

Stay tuned to my blogtwitter or facebook to read more articles, tutorials, news, tips & tricks on various technology fields. Also Subscribe to our Newsletter with your Email ID to keep you updated on latest posts. We will send newsletter to your registered email address. We will not share your email address to anybody as we respect privacy.


This article is related to

C#,.NET,Architect,Intermediate,Dependency Injection,MVC,.Net,Articles,Computer Tutorials, ASP.Net

Thursday, July 4, 2013

Dependency Injection for Loose Coupling

In designing an object-oriented application, a major tenet of design is "loose coupling". Loosely, not meant for the pun, "loose coupling" means that objects should only have as many dependencies as is needed to do their job - and the dependencies should be few. Furthermore, an object's dependencies should be on interfaces and not on "concrete" objects, when possible. (A concrete object is any object created with the keyword new.) Loose coupling promotes greater reusability, easier maintainability, and allows you to easily provide "mock" objects in place of expensive services, such as a socket-communicator. "Dependency Injection" (DI), also more cryptically known as "Inversion of Control" (IoC), can be used as a technique for encouraging this loose coupling. There are two primary approaches to implementing DI: constructor injection and setter injection. Obviously, at some point, something must be responsible for creating the concrete objects that will be injected into another object. The injector can be a parent object, which I'll call the "DI controller", or can be externalized and handled by a "DI container" framework. What follows is a brief overview of the various approaches for using dependency injection techniques.


I guess you came to this post by searching similar kind of issues in any of the search engine and hope that this resolved your problem. If you find this tips useful, just drop a line below and share the link to others and who knows they might find it useful too.

Stay tuned to my blogtwitter or facebook to read more articles, tutorials, news, tips & tricks on various technology fields. Also Subscribe to our Newsletter with your Email ID to keep you updated on latest posts. We will send newsletter to your registered email address. We will not share your email address to anybody as we respect privacy.


This article is related to

</ span>C#,.NET,Architect,Intermediate,VS2010,.Net,Articles,Computer Tutorials,Design Pasttern,Dependency Injection,Dependency Injection for Loose Coupling

Monday, June 3, 2013

Dependency Injection / Inversion of Control–A Concrete Example-Roll your own

How exactly does Dependency Injection work? It seemed rather mysterious to me from the implementation point of view. Some people look at a compiler and think, "Wow, that's cool how it could translate source code into machine code."


I guess you came to this post by searching similar kind of issues in any of the search engine and hope that this resolved your problem. If you find this tips useful, just drop a line below and share the link to others and who knows they might find it useful too.

Stay tuned to my blogtwitter or facebook to read more articles, tutorials, news, tips & tricks on various technology fields. Also Subscribe to our Newsletter with your Email ID to keep you updated on latest posts. We will send newsletter to your registered email address. We will not share your email address to anybody as we respect privacy.


This article is related to

</ span>C#,.NET,Architect,Intermediate,VS2010,.Net,Articles,Computer Tutorials,Dependency Injection,Inversion of Control

Design pattern – Inversion of control and Dependency injection

In this section we will discuss about how IOC and DI can help us build loosely coupled software architecture. I am not sure should we call this a design pattern or more of a approach. If you search around the web you will see lot of controversy on whether IOC is a design pattern or not. From my point of view it is a design pattern as it solves a problem context.


I guess you came to this post by searching similar kind of issues in any of the search engine and hope that this resolved your problem. If you find this tips useful, just drop a line below and share the link to others and who knows they might find it useful too.

Stay tuned to my blogtwitter or facebook to read more articles, tutorials, news, tips & tricks on various technology fields. Also Subscribe to our Newsletter with your Email ID to keep you updated on latest posts. We will send newsletter to your registered email address. We will not share your email address to anybody as we respect privacy.


This article is related to

</ span>C#,.NET,Architect,Intermediate,VS2010,.Net,Articles,Computer Tutorials,Dependency injection,Inversion of control,Design pattern

Inversion of Control Containers and the Dependency Injection pattern

In the Java community there's been a rush of lightweight containers that help to assemble components from different projects into a cohesive application. Underlying these containers is a common pattern to how they perform the wiring, a concept they refer under the very generic name of "Inversion of Control". In this article I dig into how this pattern works, under the more specific name of "Dependency Injection", and contrast it with the Service Locator alternative. The choice between them is less important than the principle of separating configuration from use.


I guess you came to this post by searching similar kind of issues in any of the search engine and hope that this resolved your problem. If you find this tips useful, just drop a line below and share the link to others and who knows they might find it useful too.

Stay tuned to my blogtwitter or facebook to read more articles, tutorials, news, tips & tricks on various technology fields. Also Subscribe to our Newsletter with your Email ID to keep you updated on latest posts. We will send newsletter to your registered email address. We will not share your email address to anybody as we respect privacy.


This article is related to

</ span>Articles,Computer Tutorials,Inversion of Control,Dependency Injection,Containers and the Dependency Injection

Monday, May 6, 2013

Generic repository pattern using EF with Dependency injection (Ninject)

We can perform CRUD operation easily using entity framework in MVC. Using generic repository pattern we don't require writing repetitive code for CRUD operation, using generic repository pattern we can achieve this functionality easily.


I guess you came to this post by searching similar kind of issues in any of the search engine and hope that this resolved your problem. If you find this tips useful, just drop a line below and share the link to others and who knows they might find it useful too.

Stay tuned to my blogtwitter or facebook to read more articles, tutorials, news, tips & tricks on various technology fields. Also Subscribe to our Newsletter with your Email ID to keep you updated on latest posts. We will send newsletter to your registered email address. We will not share your email address to anybody as we respect privacy.


This article is related to

</ span>C#,.NET,Architect,Intermediate,VS2010,.Net,Articles,Computer Tutorials,Entity Framework,Dependency Injection,Ninject,Repository Pattern

Tuesday, March 26, 2013

ASP.NET MVC Controller Dependency Injection for Beginners

In a simple statement if I want to define an ASP.NET MVC controller then I can say that classes that are responsible for receiving and processing incoming http requests, handling client input, and sending response back to the client. Controllers also act as a coordinator between Model (Business) and View (Presentation). ASP.NET MVC framework itself creates controller objects at run time. There is only one prerequisite, that is controller class must have a parameter less constructor. But if you need to pass some objects with constructor then what will happen? Simply framework will fail to create controller object. In that case we need to create controller objects by our self and inject dependency there. There are many ways you can inject dependency to a class. For example, it might be Property setter, Method, Constructor injection. In this article I will explain how to inject controller dependency to ASP.NET MVC framework with the help of constructor. Without creating custom controller factory inject dependency to controllers are not possible. So I will also explain how to create a very simple custom controller factory and register it to ASP.NET MVC framework. I will also demonstrate a way to inject dependency to controllers using Managed Extensible Framework (MEF).


I guess you came to this post by searching similar kind of issues in any of the search engine and hope that this resolved your problem. If you find this tips useful, just drop a line below and share the link to others and who knows they might find it useful too.

Stay tuned to my blogtwitter or facebook to read more articles, tutorials, news, tips & tricks on various technology fields. Also Subscribe to our Newsletter with your Email ID to keep you updated on latest posts. We will send newsletter to your registered email address. We will not share your email address to anybody as we respect privacy.


This article is related to

</ span>C#,.NET,Architect,Intermediate,VS2010,.Net,Articles,Computer Tutorials,ASP.Net, Dependency Injection

Build Asp.net Dependency Injection, IoC plugin base on Autofac

There are quite a lot good articles about asp.net dependency injection and IoC, most solutions seems attractive but you have to develop everything almost from scratch. Fortunately, there are some elegant IoC frameworks kill the pain, like Autofac and Spring.net. Autofac steps further to develop some libraries to integrate with Asp.net, which save much time for us. So what's this article for? I'm not trying to invent new wheel, but to bring Ioc & DI features into Asp.net plugin framework by integrating Autofac, and this solution is also valid for integrating other libraries.


I guess you came to this post by searching similar kind of issues in any of the search engine and hope that this resolved your problem. If you find this tips useful, just drop a line below and share the link to others and who knows they might find it useful too.

Stay tuned to my blogtwitter or facebook to read more articles, tutorials, news, tips & tricks on various technology fields. Also Subscribe to our Newsletter with your Email ID to keep you updated on latest posts. We will send newsletter to your registered email address. We will not share your email address to anybody as we respect privacy.


This article is related to

</ span>C#,.NET,Architect,Intermediate,VS2010,.Net,Articles,Computer Tutorials,ASP,ASP.Net,Dependency Injection,IoC plugin,Autofac

Monday, March 18, 2013

Dependency Inversion Principle, IoC Container & Dependency Injection (Part - 2)

This is the continuation part of the article on Dependency Inversion Principle, IoC Container & Dependency Injection. In the previous part of this article I explained about what is Dependency Inversion Principle and its benefit. In this part of the article I will be covering Inversion Of Control (IoC) and what is an IoC Container.


I guess you came to this post by searching similar kind of issues in any of the search engine and hope that this resolved your problem. If you find this tips useful, just drop a line below and share the link to others and who knows they might find it useful too.

Stay tuned to my blogtwitter or facebook to read more articles, tutorials, news, tips & tricks on various technology fields. Also Subscribe to our Newsletter with your Email ID to keep you updated on latest posts. We will send newsletter to your registered email address. We will not share your email address to anybody as we respect privacy.


This article is related toC#,.NET,Architect,Intermediate,VS2010,.Net,Articles,Computer Tutorials,Dependency Inversion,IoC Container,Dependency Injection

Tuesday, March 12, 2013

Dependency Inversion Principle, IoC Container & Dependency Injection (Part - 1)

While working on a WPF application, I came across such kind of terms like Unity Container, IoC, Dependency Injection. At that time I was in a confusion, thinking of the need of all these. But later on when I gradually knew about the benefits, I realized the actual need of it.


I guess you came to this post by searching similar kind of issues in any of the search engine and hope that this resolved your problem. If you find this tips useful, just drop a line below and share the link to others and who knows they might find it useful too.

Stay tuned to my blogtwitter or facebook to read more articles, tutorials, news, tips & tricks on various technology fields. Also Subscribe to our Newsletter with your Email ID to keep you updated on latest posts. We will send newsletter to your registered email address. We will not share your email address to anybody as we respect privacy.


This article is related to

</ span>IoC Container, Dependency Injection, .Net, .Net Tutorials

ASP.NET MVC controller dependency injection for beginners

In a simple statement if I want to define an ASP.NET MVC controller then I can say that it has classes which are responsible for receiving and processing incoming requests, handling client input, and sending response back to the client. Controllers also act as a coordinator between Model (Business) and View (Presentation). ASP.NET MVC framework itself create controller object at run time. Only prerequisite is controller class must have a parameter less constructor. But if you need to pass some objects with constructor then what will happen? Simply framework failed to create controller object. In that scenario we need to create controller object by our self and injection dependency there.


I guess you came to this post by searching similar kind of issues in any of the search engine and hope that this resolved your problem. If you find this tips useful, just drop a line below and share the link to others and who knows they might find it useful too.

Stay tuned to my blogtwitter or facebook to read more articles, tutorials, news, tips & tricks on various technology fields. Also Subscribe to our Newsletter with your Email ID to keep you updated on latest posts. We will send newsletter to your registered email address. We will not share your email address to anybody as we respect privacy.


This article is related to

</ span>ASP.NET, MVC, Dependency Injection, Computer Tutorials, .Net, Beginners Tutorials

Saturday, February 23, 2013

A Google Guice Like iOS Objective-C Dependency Injection Framework

An iOS objective-C framework inspired by Google's Guice dependency objection framework allowing you to handle everything Objective-C.

As the readme states:

Objection is a lightweight dependency injection framework for Objective-C for MacOS X and iOS. For those of you that have used Guice, Objection will feel familiar. Objection was built to stay out of your way and alleviate the need to maintain a large XML container or manually construct objects.

You can find the Objection homepage here.

You can find the source code repository on Github here.

Much more information including examples can be found on the homepage.

I guess you came to this post by searching similar kind of issues in any of the search engine and hope that this resolved your problem. If you find this tips useful, just drop a line below and share the link to others and who knows they might find it useful too. 

Stay tuned to my blogtwitter or facebook to read more articles, tutorials, news, tips & tricks on various technology fields. Also Subscribe to our Newsletter with your Email ID to keep you updated on latest posts. We will send newsletter to your registered email address. We will not share your email address to anybody as we respect privacy.


This article is related to

iPad,iPhone,iPhone Resources,iPhone Articles,iPhone Development,iPhone Turorial,Mobile Development Tutorials,Mobile Developments,Objective C,Dependency Injection,Dependency Injection Framework,Objective-C Dependency Injection

Friday, February 1, 2013

Injection for Xcode Source

Injection is a plugin for Xcode that allows you to "inject" Objective-C code changes into a running application without having to restart it during development and testing. After making a couple of minor changes to your application's "main.m" and pre-compilation header it will connect to a server running inside Xcode during testing to receive commands to load bundles containing the code changes you make.

✔ Read More...


I guess you came to this post by searching similar kind of issues in any of the search engine and hope that this resolved your problem. If you find this tips useful, just drop a line below and share the link to others and who knows they might find it useful too.

Stay tuned to my blogtwitter or facebook to read more articles, tutorials, news, tips & tricks on various technology fields. Also Subscribe to our Newsletter with your Email ID to keep you updated on latest posts. We will send newsletter to your registered email address. We will not share your email address to anybody as we respect privacy.


This article is related to

iPad,iPhone,iPhone Resources,iPhone Articles,iPhone Development,iPhone Turorial,Mobile Development Tutorials,Mobile Developments,Objective C,Dependency Injection,xCode

Tuesday, December 4, 2012

Dependency Injection In PHP

Dependency injection has been a frequent subject of discussion among many corporate developers in the past few years. Many feared that they might sacrifice too much time building their application architecture without doing any real work. In this article, I'll explain why PHP developers should consider taking advantage of dependency injection, when building large, scalable projects.

✔ Read More...


I guess you came to this post by searching similar kind of issues in any of the search engine and hope that this resolved your problem. If you find this tips useful, just drop a line below and share the link to others and who knows they might find it useful too.


I guess you came to this post by searching similar kind of issues in any of the search engine and hope that this resolved your problem. If you find this tips useful, just drop a line below and share the link to others and who knows they might find it useful too.

Stay tuned to my blogtwitter or facebook to read more articles, tutorials, news, tips & tricks on various technology fields. Also Subscribe to our Newsletter with your Email ID to keep you updated on latest posts. We will send newsletter to your registered email address. We will not share your email address to anybody as we respect privacy.


This article is related to

Computer Tutorials,PHP,Web Development,Dependency Injection

Saturday, November 24, 2012

Dependency Injection and Service Locator

Dependency injection is a interface programing technique which is based on altering class behavior without the changing the class internals. That's been done by coding against interface inside of the class and exposing interface definition to code external to the component. There are three types (different techniques) of making dependency injection: constructor DI, setter DI and interface DI.

Service locator is a design pattern similar to dependency injection in a meaning that allows altering the class behavior without altering the class code by coding against the interface inside of the class. The difference is that there's no direct exposure of interface to code outside of the class. Instead class is using "well known object" inside, to get from it desired interface implementation.

Read More...

I guess you came to this post by searching similar kind of issues in any of the search engine and hope that this resolved your problem. If you find this tips useful, just drop a line below and share the link to others and who knows they might find it useful too.

Stay tuned to my blogtwitter or facebook to read more articles, tutorials, news, tips & tricks on various technology fields. Also Subscribe to our Newsletter with your Email ID to keep you updated on latest posts. We will send newsletter to your registered email address. We will not share your email address to anybody as we respect privacy.


This article is related to
C#,.NET,Architect,Intermediate,VS2010,.Net,Articles,Computer Tutorials,Dependency Injection, Service Locator

Tuesday, November 20, 2012

Dependency Injection With Ninject

Ninject is a lightweight dependency injection framework for .NET applications. It helps you split your application into a collection of loosely-coupled, highly-cohesive pieces, and then glue them back together in a flexible manner. By using Ninject to support your software's architecture, your code will become easier to write, reuse, test, and modify.

You can find out more about Ninject at github here.

I guess you came to this post by searching similar kind of issues in any of the search engine and hope that this resolved your problem. If you find this tips useful, just drop a line below and share the link to others and who knows they might find it useful too. 


Stay tuned to my blogtwitter or facebook to read more articles, tutorials, news, tips & tricks on various technology fields. Also Subscribe to our Newsletter with your Email ID to keep you updated on latest posts. We will send newsletter to your registered email address. We will not share your email address to anybody as we respect privacy.


This article is related to
C#,.NET,Architect,Intermediate,VS2010,.Net,Articles,Computer Tutorials,Dependency Injection,Ninject

How to Use Dependency Injection (Ninject) with WCF Services

I spent a lot of time late last week trying to figure out exactly how to set up dependency injection for a WCF service I was developing on Windows Azure; there's some documentation out there on how to do it, but it's not nearly as helpful as I would like it. Thus I decided to document how I made WCF and Ninject play nice with each other, and I even provide a sample template you can use yourself.


I guess you came to this post by searching similar kind of issues in any of the search engine and hope that this resolved your problem. If you find this tips useful, just drop a line below and share the link to others and who knows they might find it useful too. 


Stay tuned to my blogtwitter or facebook to read more articles, tutorials, news, tips & tricks on various technology fields. Also Subscribe to our Newsletter with your Email ID to keep you updated on latest posts. We will send newsletter to your registered email address. We will not share your email address to anybody as we respect privacy.


This article is related to
C#,.NET,Architect,Intermediate,VS2010,.Net,Articles,Computer Tutorials,Dependency Injection,Ninject,WCF

Sunday, November 18, 2012

Dependency Injection Using Ninject

"Ninject is a lightweight dependency injection framework for .NET applications. It helps you split your application into a collection of loosely-coupled, highly-cohesive pieces, and then glue them back together in a flexible manner. By using Ninject to support your software's architecture, your code will become easier to write, reuse, test, and modify."


I guess you came to this post by searching similar kind of issues in any of the search engine and hope that this resolved your problem. If you find this tips useful, just drop a line below and share the link to others and who knows they might find it useful too.

Stay tuned to my blogtwitter or facebook to read more articles, tutorials, news, tips & tricks on various technology fields. Also Subscribe to our Newsletter with your Email ID to keep you updated on latest posts. We will send newsletter to your registered email address. We will not share your email address to anybody as we respect privacy.


This article is related to
C#,.NET,Architect,Intermediate,VS2010,.Net,Articles,Computer Tutorials,Dependency Injection,Ninject

Dependency Injection (DI) – Hello World with Ninject

I am going to start with explaining a simple scenario where we could use the DI pattern. I will be using Ninject to write dependency injections. If you want to try other frameworks, Scott Hanselman has a great list of them for .net here.
Let's say we need to create a software called XDoc which is a word text editor. And we will implement a part of it which is able to write to different mediums – console (stdout), file, pdf file, doc file and so on…


I guess you came to this post by searching similar kind of issues in any of the search engine and hope that this resolved your problem. If you find this tips useful, just drop a line below and share the link to others and who knows they might find it useful too.

Stay tuned to my blogtwitter or facebook to read more articles, tutorials, news, tips & tricks on various technology fields. Also Subscribe to our Newsletter with your Email ID to keep you updated on latest posts. We will send newsletter to your registered email address. We will not share your email address to anybody as we respect privacy.


This article is related to

Computer Tutorials,Dependency Injection,Dependency Injection with Ninject, Dependency Injection in .Net