About .NET , C#, ASP.NET , SharePoint , Umbraco , SQL Server , Business Intelligence and more...
Thursday, May 1, 2014
.NET Platform
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
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
- 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
- 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.
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
- 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...
-
Factory method pattern is a type of Creational category of Design pattern. Factory Method Pattern defines an interface for creating object...
-
Unity is a light weight container used for dependency injection which supports interface, constructor, property and method level injection...
-
We have two different approaches towards SharePoint installation such as Standalone installation and Complete installation. Standalone insta...
