Monday 22 June 2015

Dependency Injection in Spring.Net

Spring.net developers in India

Dependency Injection is a technique that provides decoupling application from the actual implementation during design/compile time and link them at run time. 

When we consume a class instance like ClassB from another class instance ClassA at compile time, then any changes which going to be made to ClassB will affect ClassA. For any single change, we need to recompile, redeploy the whole thing. Here, there is a static or compile time binding between ClassA and ClassB. Dependency Injection is one of the techniques that relieves us from the pain of static binding and decouples ClassA and ClassB at runtime. The end result, a decoupled or loosely coupled system.

Let’s consider an application being developed by software development companies which contains three layer Presentation Layer (UI), Business Login (BAL) Layer and Data Access Layer (DAL).  In that UI interacts with BAL and BAL interact with DAL. In tightly coupled system, UI is depended on BAL and BAL is depended on DAL so problem is that if make any changes in DAL then it is required to compile or redeploy rest of the layer. Where in case of loosely coupled system any instance can be changed at runtime rather than compile time. So by enforcing DI in application development we can link the layer at runtime, we can also develop layer independently and integrate later.  

Advantage of Using DI:

  • Consider following for DI, whichcan be used in a real time:
  • The dependent layer can be changed at runtime based on the environment.  
  • The rapidly bug fixes can be done offline and linked at integration/testing phase 
  • Side by side development of different layers which can be linked at integration phase.

Creating loosely typed System Using Dependency Injection

At first, create layered architecture in which there are Presentation, Business login and Data Access layer. UI interacts with Business Login and Business Login further interact with Data Access layer to get data.

Here by adding dependency injection in layered architecture, we can get change any instance at runtime rather than at compile time so there will not any dependency among all layers. Moreover, we are going to link layer at runtime.

Steps to implement DI in DotNet:

  1. At first, it is required to create Interfacefor all layers, especially interface for Business login and Data access layer which contain method definition.
  2. Give implementation of interface by both layers, BAL and DAL respectively.
  3. Perform Spring configuration in dotnet in configuration file in which create unique instant for all above layer so that they can serve multiple request.
  4. Add reference for Spring.Core in application and initialize your configuration by ContextRegistry.GetContext() method which validates about existence of your objects that you have created in configuration file and this method will return IApplicationContext instance
  5. Now once instance is initialized then you can call method of DAL from BAL instance.

Real time use:

  • Runtime change the dependent layer like create two kind of environment one for production which contains actual implementation and another for testing environment.
  • Parallel development of layer and final can be integrated or linked.
  • decoupling application from the actual implementation during design/compile time and link them at run time is the prime use of dependency injection for custom software development companies


Tuesday 16 June 2015

Overview of Spring.NET

Spring.net developers in India

Spring.Net is open source framework which is used to develop enterprise level light-weight application to custom software development companies. The design of Spring.Net is based on the Java Spring Framework. Spring.Net provides following:

  • Dependency Injection
  • Integrate Aspect-Oriented Programming in application.
  • Transaction management for middle tier.

Spring.Net is application at so many area. Core features, such as the Dependency Injection, AOP and the data access framework can be used in pretty much any .NET application. They allow you to create simple and pure applications. 
Spring.Net consists of following main modules:

  • Spring.Core: Configure your application using DI
  • Spring.Aop: Provides various libraries for transactions, logging, performance monitoring, caching and exception handling.
  • Spring.Data: Support data access facilities with ADO.NET.
  • Spring.Data.NHibernate: Integrating hibernate with transaction management and provides object relational mapping.
  • Spring.Services: This includes dotnetremoting,web services using DI. 
  • Spring.Web: Provides level of abstraction with ASP.NET web application.
  • Spring.Web.Mvc3/4/5: Integrates Spring.Core and Spring.Aop into Dotnet MVC.

Spring.Net also support WCF integration which provides dependency Injection and application of AOP to WCF service.
It is not compulsory that custom software development companies have to use all the above module or not anything. It just likes creating ASP.NET front-end and write business logic using IOC and interact with middle layer which supports various services like transaction management along with accessing data.

Monday 15 June 2015

What is Spring.net?

Spring.net developers in India

Spring.Net is application framework which helps to develop enterprise .NET applications to asp.net software development companies. The main important features of spring.net is Dependency Injection (DI) or Inversion of Control (IC) and AOP framework which is very useful and completely platform independent. In this report I am going to present advantages of loosely coupled system over tightly coupled system and also create loosely coupled by inserting dependency injection. Sometimes in complex system it is difficult to link modules or layered at runtime means each layered are depended, like UI interacts with business login (BAL) and further BAL interacts with data access layer (DAL) so if we made any changes to DAL then we have to make change to respective layer too. So I have shown implementation by using dotnet framework and spring.net library and create MVP kind of layer architecture.

Keywords: DI, AOP, BAL (Business Access Layer), DAL (Data Access layer).

Objectives

  • Main objective to use Spring.net is its one of features like Dependency Injection which simplifies coupling related issues and provide loosely couple code.
  • Reduce tight coupling among different software components.
  • Easily manage future changes and complexity.
  • Another objective to achieve AOP- aspect-oriented programming which increase modularity by separation of code.

Software development companies can use SPRING.NET for the development of enterprise applications to make them robust, reliable and safe.