Dot Net Stuff

Understanding Simple Factory Design Pattern implementation with real world example

Simple Factory Design Pattern doesn’t belong to the Gangs of Four. A Simple Factory Pattern is one of that returns an instance of one of several possible classes, depending on the data provided to it. This implies that the classes it returns have same parent class and methods, but each of them perform task differently for different kind of data. Continue Reading>>

Exploring .Net Design Patterns in Software development

Design patterns were introduced by GOF(Gangs Of Four) Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides’s seminal work Design Patterns: Elements of Reusable Object-Oriented Software (Addison-Wesley).

Design patterns provide a high-level language of discourse for programmers to describe their systems and to discuss solutions to common problems. This language comprises the names of recognizable patterns and their elements. Each design pattern shave its own templates and these patterns have illustrative names and are described with diagrams illustrating, their role players. There are 23 design patterns. These patterns are divided into three groups: structural, creational, and behavioral.

Continue Reading>>

Understanding URL Rewriting and URL Attribute Routing in ASP.NET MVC (MVC5) with Examples

Url Rewriting and Routing is how ASP.NET MVC matches a URI to an action. MVC 5 supports a new type of routing, called attribute routing, which is also works in ASP.NET vNext. Attribute routing uses attributes to define routes. Attribute routing provides us more control over the URIs in your web application.

Continue Reading>>

ASP.NET vNext Overview & features (MVC6, Web API, Web Pages and Single R)

Microsoft has announced to launch ASP.NET vNext, which includes MVC, Web API, and Web Pages frameworks will be merged into one framework, called MVC 6. This new framework removes a lot of overlap between the existing MVC and Web API frameworks. It uses a common set of abstractions for routing, action selection, filters, model binding, and so on. You can use the framework to create both UI (HTML) and web APIs.

Continue Reading>>

Understanding Best Way to Use Multiple Models in ASP.NET MVC

It is depend upon our requirement to use multiple Models in ASP.NET MVC application, in this article, we will discuss how to choose the most suitable way to use multiple models from controller to view in ASP.NET MVC. In my one of the article, we have seen various way to use multiple Models in ASP.NET MVC application. i.e., ViewModel, Patial View, Tuple, ViewData, ViewBag and TempData in the article "Way to Use Multiple Models in a view in ASP.NET MVC". It may be hard for beginners to decide while selecting a way to be used in a particular scenario. In this article, I will discuss how to choose best way to use multiple Models in ASP.NET MVC application.Continue Reading>>

Way to Use Multiple Models in a view in ASP.NET MVC

For ASP.NET MVC beginner, it is very common problems that they faces in programming world: That how they can use multiple Models in their ASP.NET MVC application’s view. Some of beginners is familiar with some of way to use multiple Models in an ASP.NET MVC application. But, May be they are not know about all the way to use Multiple Models in ASP.NET MVC. Here, in this article I am going to share all the possible ways to use multiple Models in a view. I am assuming that you will familiar with C# and ASP.NET MVC. If you are new to C# and ASP.NET MVC, you can look for different articles to learn ASP.NET MVC. Still, if you will face any issue you can put comment below article in case you need any detail. Continue Reading>>

Exploring Layouts, RenderBody, RenderSection and RenderPage in ASP.NET MVC

One of the major requirements for our web application is to maintain a consistent look and feel across all of the pages within your web-site/application. ASP.NET 2.0 introduced the concept of “Master Pages” which helps enable this when using .aspx based pages or templates. To achieve this concept in ASP.NET MVC application, Razor View Engine supports this concept with a feature called “layouts”- which allow us to define a common site template, and then inherit its look and feel across all the views/pages on our site. Following code sample show the basic structure of Layout.cshtml file.

Continue Reading>>

How to Render different Layout in ASP.NET MVC

It is very important to understand rendering Layouts in ASP.NET MVC. To understand Layouts Asp.Net MVC, we can consider Layouts are like as Master Pages in Asp.Net Web Forms. That’s why, as Master Pages allow us to maintain consistent look and feel across the ASP.NET Web Forms, Layouts are also help us to maintain consistent look and feel across all the views within your Asp.Net MVC application. Like Master Pages, Layout may contain common CSS, jQuery files across the multiple Views and one or more placeholders for which Views provide content. You must read the article to understand layout and its components Layouts, RenderBody, RenderSection and RenderPage in ASP.NET MVC.

Continue Reading>>

Understanding ASP.NET MVC Filters and Attributes

ASP.NET MVC Filters allow us to inject extra logic into MVC Framework request processing, this logic either before or after an action is executed. They provide a simple and elegant way to implement cross-cutting concerns. This term refers to functionality that is used all over an application and doesn’t fit neatly into any one place, where it would break the separation of concerns pattern. Classic examples of cross-cutting concerns are logging, authorization, and caching. In this article, I will show you the different categories of filters that the MVC Framework supports, how to create and use filters, and how to control their execution. We can make your own custom filters or attributes either by implementing ASP.NET MVC filter interface or by inheriting and overriding methods of ASP.NET MVC filter attribute class if available.

Continue Reading>>

Understanding Model Binding in ASP.NET MVC with Example

A view can display a form that has fields such as text boxes, check boxes, radio buttons, and so forth, and a submit button. When the user submits the form, the information in the fields is sent to the controller.ASP.NET uses an HttpRequest object to handle requests. Information coming in the request is stored in different collection objects depending on how the request was sent and the type of information. For example, if the request was sent via HTTP GET, such as http://www.DotNet-Tutorial.com/page?id=1&v=true, then the values for the parameters id and v are stored in the HttpRequest.QueryString collection. If the request is sent using HTTP POST, then the values are stored in the HttpRequest.Form collection. Uploaded files are stored in the HttpRequest.Files collection. If the request is based on a route, then the values are stored in the RouteData.Values dictionary.

Continue Reading>>