Skip to main content

Posts

C# Cheat Sheet : Part 1

Constructors Constructors are used to Initialize the objects, parameters when the object is getting initialized,  Constructors can be of type Public Private Protected  Internal Protected Internal Static  Public Constructors This type will be instantiated every time the new operator is used for the class or struct, Typically constructors will be without any parameters, For Example  Class Cls = new Class ();   but this will not be the case always, you can instantiate the class by practically  any number of arguments .  Private Constructors If the programmer doesn't want a particular class to be instantiated but wants the client code to use the class members then the programmer may set the constructor to be private Example Program: The following program generates the number of desired GUIDs, and the class initialization is freezed by private constructor     public class StringAppend     {         private StringAppend()  

ASP.NET MVC Learning : Routing Advanced

To specify a route you need to create the instance of the class Route by specifying the  * URL Pattern Name  * URL Pattern   * Handler URL Name   Can be of any name and empty string '' is allowed URL Pattern  Default (System generating) URL pattern is {controller}/{action}/{id}, however you can use the following patterns as you want employee/{action}/{entry} --> employee/update/111 {reportname}/{year}/{month} --> employeeattendance/2018/06 {classcode}-{studentid}/{action} --> XII/212/show Handler There are three types of handlers used, MvcHandler, This handler is initiating the ASP.NET pipeline for the ASP.NET MVC application, as this is receiving the controller instance from MVC controller factory, which takes care of further processing  MvcRouteHandler  MvcRouteHandler is implementing the IRouteHandler interface and pass the request context to it. MvcHttpHandler Used to handle the mapping directly without going through the routing mod

ASP.NET MVC Learning 1 : Introduction

ASP.NET MVC is the open source web application building framework from Microsoft which implements (M-V-C) pattern,   M - Model  --> Contains Data and information on how to handle data (Business Logic) V - View --> Representation of data to the user (User Interface, Front End) C - Controller --> Sits between the Model and View, acts as interface between them, basically the controller takes the user request and provide the view with correct model data   This is software developing pattern which implements Seperation of Concerns (SoC), which decouples all the three components to enable it for better parallel programming, Advantages of MVC pattern Easy and Fast Development of code More meaningful URLs which provides the competetive edge over traditional URLs  Change Friendly Maintenance Friendly Test Friendly (Test Driven Development is fully supported) Easy to divide the application and respective teams such as Design Team, Developent Team, Database Team can co

ASP.NET MVC Learning 3 : Global.asax File

The Global.asax file is called as the ASP.NET application file, which contains the events related to Application and Session level The file will be positioned in the root level of the Web Application. Adding this file to the application is not mandatory, if you want to handle the Application events or session events then you can use the file The following are the events available in the file,         protected void Application_Start( object sender, EventArgs e)         {            // Triggered when the application starts, the logs to the event handler, initializing singleton objects may be written here         }         protected void Session_Start( object sender, EventArgs e)         {         }         protected void Application_BeginRequest( object sender, EventArgs e)         {         }         protected void Application_AuthenticateRequest( object sender, EventArgs e)         {         }         protected void A