Thursday, May 30, 2019

Important Notes in Csharp and SQL

The break, goto, continue, return and throw statements are known as jump statements.

An Abstract class can has access modifiers like private, protected, internal with class members. But abstract members cannot have private access modifier.

Constant fields or local variables must be assigned a value at the time of declaration and after that they cannot be modified. By default constant are static, hence you cannot define a constant type as static.

Abstract Class :Need to to provide default behaviors as well as common behaviors that multiple derived classes can share and override
http://www.dotnettricks.com/learn/csharp/a-deep-dive-into-csharp-abstract-class

Unlike fields, properties do not denote storage locations and you cannot pass a property as a ref or out paramete

Auto-implemented properties was introduced with C# 3.0, which make property declaration more concise. Unlike standard property, in auto-implemented property, wrapped or backing field is automatically created by the compiler but it is not available for use by
public int Name { get; set; }

A try block is used to throw multiple exceptions that can handle by using multiple catch blocks

More specialized catch block should come before a generalized one. Otherwise specialized catch block will never be executed

Implicit conversion of derived classes to base class is called Upcasting and
Explicit conversion of base class to derived classes is called Downcasting.

Once a delegate is created, the method it is associated will never changes because delegates are immutable in nature

delegate which holds the reference of more than one method is called multi-cast delegate. A multicast delegate only contains the reference of methods which return type is void. The + and += operators are used to combine delegate instances

There are following types of decision making statements in C#
If statement
If-Else statement
If-Else-If statement or ladder
Switch statement

C# introduces a new concept known as Indexers which are used for treating an object as an array. The indexers are usually known as smart arrays in C#

--==============================------------

Super key is a set of one or more than one keys that can be used to identify a record uniquely in a table.Example : Primary key, Unique key, Alternate key are subset of Super Keys

A Candidate Key is a set of one or more fields/columns that can identify a record uniquely in a table. There can be multiple Candidate Keys in one table. Each Candidate Key can work as Primary Key.

Primary key is a set of one or more fields/columns of a table that uniquely identify a record in database table. It can not accept null, duplicate values. Only one Candidate Key can be Primary Key

A Alternate key is a key that can be work as a primary key. Basically it is a candidate key that currently is not primary key

Composite Key is a combination of more than one fields/columns of a table. It can be a Candidate key, Primary key

Unique key is a set of one or more fields/columns of a table that uniquely identify a record in database table. It is like Primary key but it can accept only one null value and it can not have duplicate values

Foreign Key is a field in database table that is Primary key in another table. It can accept multiple null, duplicate values

Views are virtual tables that are compiled at run time. The data associated with views are not physically stored in the view, but it is stored in the base tables of the view. We make views for security purpose since it restricts the user to view some columns/fields of the table(s)

-------=================================-----------------
Data Annotation Validator Attributes 
DataType, DisplayName, DisplayFormat, Required, ReqularExpression, Range, StringLength,
MaxLength, Bind, ScaffoldColumn(specify fields for hiding from editor forms)

 Partial view is like as user control in Asp.Net Web forms that is used for code re-usability. Partial views helps us to reduce code duplication

The main difference between two methods is that the Partial helper method renders a partial view into a string while RenderPartial method writes directly into the response stream instead of returning a string

We can enable the jQuery intellisense support in Visual Studio with MVC Razor by adding vsdoc.js (jquery-1.7.1-vsdoc.js)

Asp.net MVC Request Life Cycle
Browser
Request
Routing: Pattern matching system (RouteTable)
Mvc Handler: initiating the real processing (IHttpHandler)
Controller: MvcHandler uses the IControllerFactory instance and tries to get a IController instance (IControllerFactory )
Action Execution: Controller's ActionInvoker determines which specific action to invoke on the controller (ActionInvoker)
View Result: receives user input, prepares the appropriate response data, and then executes the result
View Engine: xecution of the View Result involves the selection of the appropriate View Engine
View: Action method may returns a text string,a binary file or a Json formatted data.
for more details https://www.dotnettricks.com/learn/mvc/aspnet-mvc-request-life-cycle

No comments:

Post a Comment