Thursday, May 1, 2014

.NET Platform

Initially before the .Net Platform were introduced, software development was done using COM (Component Object Model) in Windows operating systems. It was so popular just because of the language independency and reusability across different languages. The demerits of this model was the complexity in infrastructure and deployment.
Later Microsoft introduced the .NET platform in early  2002 and became so popular till date due to its features and flexibility in usage. Lets jote down the advantages of the .NET platform as follows
·         Interoperability
·         Support different languages. .NET family consists of C#,VB,F# etc.
·         Common Language Runtime caters to different .NET languages
·         Common Type System and Common Language Specifications supporting the cross language interactions
·         Base Class libraries shared by all .NET languages

·         Simplified application deployment and maintenance.


We can disucss about the above blocks indvidually in my later blog posts. Now lets see the major enhancements in the history of .NET frameworks and IDE releases.
·         .NET 1.0
o   Introduced with Visual Studio .NET.
o   Intriduced CLR 1.0
o   Support for OOPs in Web application development
o   DLL class libraries
·       . NET 1.1
o   Introduced with Visual Studio .NET 2003
o   Enhancements to ASP.NET and ADO.NET
o   Security enhancements
o   Support for ODBC and databases
·         .NET 2.0
o   Introduced with Visual Studio .NET 2005
o   CLR 2.0
o   Generics and Collections
o   Partial Class
o   Nullable Types
o   Anonymous methods
·         .NET 3.0
o   Introduced with Visual Studio .NET 2005
o   WPF
o   WCF
o   WF
·         .NET 3.5
o   Introduced with Visual Studio .NET 2008
o   Built in Ajax support
o   LINQ
o   Multi targeting Framework support
·         .NET 4.0
o   Introduced with Visual Studi .NET 2010
o   CLR 4.0
o   Managed Extensibility Frameowrk
o   Task parallel library
o   Dynamic Language Runtime
·         .NET 4.5
o   Intriduced with Visual Studio 2012
o   Enhancements to CLR 4.0
o   Async support
o   Support for Windows Store Apps

Keep watching this space for more blogs on C# in the coming days....

Tuesday, November 5, 2013

Unity Framework


Unity is a light weight container used for dependency injection which supports interface, constructor, property and method level injections.
We have the following advantages of using Unity framework


  • Supports object creation
  • Helps to specify dependecies at run time or in configuration
  • It has service location capability which helps to cache the container


We can use Unity in the following scenarios


  • Objects or Classes have dependencies with other objects or classes
  • Dependencies are very complex
  • Manage lifetime of object instances
  • Configure dependencies at run time
  • Cache or persists dependencies


We can download Unity Application block from the following url http://www.microsoft.com/en-us/download/details.aspx?id=19372.

Later in my blog posts I will walk through the implementation of Unity Framework with sample code snippets


Monday, December 31, 2012

The way to MVC4

Now we have ASP.NET MVC4 as the latest version to the MVC family. In the last three years we have seen four releases of MVC. Lets walk through the highlights of each releases as follows.


ASP.NET MVC 1:

• Scot Guthrie introduced ASP.NET MVC in Febriary 2007.

• But official ASP.NET MVC 1.0 was released in 13 March 2009

ASP.NET MVC 2:

ASP.NET MVC 2 was officilly released on March 2010 exactly one year after the prevouos version. Following are the major highlights of the release.

• UI Helpers

• Attribute based model validation both in client and server

• Strongly typed HTML helpers

• Enhancements to Visual studio

• Itroduced HTML.RenderAction

ASP.NET MVC 3:

Just after 10 months , Microsoft has released ASP.NET MVC 3.We have the following enhancements

• The Razor view engine

• Support for .NET 4 Data Annotations

• Enhanced Model validation.

• Enhanced Javascript support, Jquery validation and JSON

• Dependency resolution

• Usage of NuGet module.

ASP.NET MVC 4:

We can consider this release as much stable one compared to the older releases. Microsoft has come up with the following enhancements

• Introduced ASP.NET Web API

• Enhancements to project templates

• jQuery Mobile Project template.
• Display modes

• Bundling and minifications

• Included Json.NET and DotNetOpenAuth libraries.





Tuesday, April 24, 2012

WCF Contracts – an overview


As we know WCF is used to build service oriented applications. It’s been part of .net framework 3.0 and 3.5. Now we have few questions in mind like where to contact for a service, in which format I should send the message to the service, what happens if something goes wrong etc. In order to answer all these questions we have WCF defines contract to its consumers.
We can classify them into the three categories as follows
  • Service contract : Defines the operations that service exposes to its consumers
  • Data contract : Defines the structure of the data in message flow
  • Message contract : Defines the headers included in the message and how its structured
As a whole we can categorize the contracts as
  • Behavioral Contract :It defines how the service behaves, what operations it exposes, what kind of faults it issues and about the MEP (Message Exchange Pattern) to be used in interacting with the service etc
  • Structural Contracts:It simply defines the Data and Message contracts used by your WCF service. 
Well in my coming posts, we will define each of the above ones in details. Keep watching the blog posts.




Sunday, April 22, 2012

Windows Communication Foundation - Overview

Before getting into an overview of Windows Communication Foundation, it’s important to explain about SOA i.e Service Oriented Architecture. The W3C defines Service-Oriented Architecture as "A set of components which can be invoked and whose interface descriptions can be discovered and published". In simple terms SOA helps to integrate distributed applications by means of interface in terms of protocols and functionality.

With the above definition in mind, now we can move to WCF i.e. Windows Communication Foundation. It can be considered as a Microsoft’s contribution towards SOA. It is a platform, a framework if you will, for creating and distributing connected applications.

Simply we can define WCF as follows

WCF = Web Service +.Net Remoting + MSMQ + COM




Overview of ASP.NET MVC Project

Let’s now discuss about what ASP.NET MVC Framework installer does for us. We have the following changes happens with the installation

  • Registers System.Web.Mvc.dll in Global Assembly Cache (GAC) and a copy onto the \Program Files\Microsoft ASP.NET\ASP.NET MVC 1.0\Assemblies folder
  • Installs various ASP.NET MVC templates integrated with Visual Studio
  • Registers .mvc file extension with IIS

Now let’s discuss about the default MVC project structure. When we create a new ASP.NET MVC web application project, Visual studio itself provides with initial files and folder structure. It’s really important to learn about each of these items. So let’s discuss about the same as follows in brief

  • /App_Data : Stores file based database and other data files. IIS will not server its contents to public.
  • /bin : Contains all the required .net assemblies for the project.
  • /Content : Here we can place static files like .css which can be served to public
  • /Controllers : Project specific controller classes (derived from Controller or implements IController)
  • /Models : We place all domain model classes
  • /Scripts : We can store all static script files inside this folder
  • /Views : Holds .aspx or .ascx files
  • /Views/Shared : View templates which are not associated with any controllers
  • /Views/Web.config : This is not application’s main config file, instead it directs not to serve any .aspx files directly.
  • /Default.aspx : This is not relevant for ASP.NET MVC application but it is required for IIS6 compatibility.
  • /Global.asax : Defines global ASP.NET application object, registers your routing configuration etc. It serves the same purpose as ASP.NET Web forms.
  • /Web.config : Defines application configuration

Apart from the above common files and folders, we have certain optional files and folders as follows which serves different purposes

  • /App_GlobalResources/App_LocalResources : Stores resource files required for localization
  • /App_Browsers : Contains . browser xml file
  • /App_Themes : Contains themes and skin file
Apart from this we need to consider the naming conventions in ASP.NET MVC since it relies on convention over configuration. So the following points are really important

  • Controller classes name should end with “Controller”
  • View templates should go into /Views folder only
  • The default view for an action method should be named after the action method.
  • /Views/Shared can be used to share views across multiple controllers

So here we conclude this post just briefing about the initial files and folder structure of ASP.NET MVC project. Please note that this is not a mandatory structure for any real project scenario.

Wednesday, April 11, 2012

ASP.NET MVC Framework

Everyone is familiar with MVC i.e. at least we have been hearing this term for long in software engineering. I never been to MVC but now decided to learn basics of MVC. So what exactly is MVC is all about?

Simply by expansion it is Model View Controller. It is an architectural pattern which describes the interaction between users and application in three different roles Model (business logic), View (User interface), Controller (User input). Let’s now discuss how the interactions occur in MVC as follows

  • User interacts with the user interface with some input action (like button click)
  • Controller handles the input event and converts into an action that model knows
  • Model’s state is changed with the controller’s notification
  • View queries model to generate the Model to generate the user interface

MVC facilitates a separation of concerns, maintainability and testability of the application development.

Now ASP.NET MVC Framework is a web application framework which implements MVC pattern. So let’s see the few facts about ASP.NET MVC framework as follows

  • It supports separation of application tasks, testability and test driven development. All contracts are interface based and easy to mock and unit test.
  • Easy to extend, customize and plug our own components.
  • It has a powerful URL mapping component which helps to provide a SEO friendly URLs
  • Still we have the advantage of using existing ASP.NET page, user controls and master pages as well.
  • Supports all the existing features like windows and forms authentication, membership and roles concept etc.
  • It does not use view state or server based controls and hence provide complete flexibility for developers
  • It relies n Front controller pattern and hence processes all requests through single controller
  • Better support for test driven development.

It’s all depends on our decision whether to go for MVC based Web application or Web forms based Web application. Keep watching this blog for more posts in MVC on a daily basis J

Installing ASP.NET MVC

Installing ASP.NET MVC Before we dive deep into the ASP.NET MVC, let’s install it our development machine. This is very straight forwa...