Skip to main content

Posts

Showing posts from March, 2011

Implementing dependency injection pattern in .NET

Dependency injection pattern is a Software and Architecture designing technique that enables to us to separation of concerns,Modules,Classes and Extensibility of Software Development Project. It enables developer to reduce the complexity of project and you can also add new features to software without modifying whole structures. Let’s first understand how dependency injection is important and why we need it.

Why we need dependency inejction?
Let’s a take two class example of shopping cart. I am having two classes ProductDAL and ProductBLL.Here ProductDAL class represent whole data access Methods while ProductBLL implements whole Business logic in software. In normal scenario what we are doing do we will create a new object ProductDAL classes and then we will use that class for our database operations like below.
Public Class ProducDAL { //Methods for database operations } Public Class ProductBLL { ProductDAL objectProductDAL=new ProductDAL(); //Methods for business logic where we …

Three new Action Result Type in ASP.NET MVC 3

In ASP.NET MVC incoming browser request mapped to a controller’s action method and that action method returns type of ActionResult in response to the browsers request. I was playing bit with ASP.NET MVC3 to check out new features of ASP.NET MVC 3 and I have found three great new ActionResult Type. Below is details explanation of each one.HttpNotFound: This return type returns a error 404 on client. This action result type can be very useful when we have resources that are not found and so we can notify the client with 404 error.RedirectResult:This returns a temporary redirect code 302 or permanent redirect code 302 depending upon a Boolean flag. This kind of redirection is very important for Search Engine optimization. I have already discussed this feature with asp.net 4.0 here. HttpStatusCodeResult: Returns a user specified code so developer have choice to return specific error code.Here are code example of Action ResultType how we can use that in code.public ActionResult SpecificRes…

My blog post is appearing on Microsoft Official ASP.NET site.

Today I got a surprise from the Microsoft. One of my friend Hajan Informed me that my blog post is appearing on the Microsoft Official asp.net site www.asp.net. This is great surprise and honor for me that my blog post are appearing on Microsoft official site.I would like to thanks all the peoples who are supporting me and all the people who are their to correct me If I am wrong. Thank you once again!!. I will continue to writing my blogs to serve community and this kind of encouragement give more boost for writing blogs. Stay tuned for more.. I will keep writing.. Thank you readers..Technorati Tags: ,

Working with more then one web.config files in asp.net application.

Recently one of reader of my blog how we can work with more then one web.config files in asp.net application. So I decided to blog about that. Here is the my reply for that.You can work with more then one web.config file in asp.net. But you can not put more then one web.config in each folder. Let’s first understand the hierarchy of web.config and other configuration file settings. On the top of the every configuration files you will have machine.config file which will have all system wide configuration settings.You can find this file in your OS drive like C: /windows/Microsoft.NET/vFrameworkNumber/Config folder. Here framework number with what ever framework you are using 1.1/2.0 or 4.0. You can override those settings in web.config file at the your application root folder. Same way you can add more web.config file in subfolder and can override the setting of parent folder web.config file. So we will hierarchy like below.Now let’s Create Project for it. In that I have create two web.c…

TSQL Quiz 2011 on beyondrelational.com

One of the my friend Jacob Sebastian running a SQL Server TSQL quiz on his site beyondrelational.com. This is a great opportunity to learn TSQL and win great price Like Apple IPad and other lots of cool stuff. So if you are expert and if you learning TSQL then its a great way to test your knowledge.For whole month of march selected quiz master will ask a question and you have to answer all this question day by day and at the end of month you will have great chance to win Apple Ipad.For more details you can visit following link:http://beyondrelational.com/quiz/SQLServer/TSQL/2011/default.aspxHope you liked it.Stay tuned for more..