Month: March 2018

Index in SQL

An index is used to speed up searching in the SQL Server database. An index can be used to efficiently find all row matching some column in your query and then walk through only that subset of the table to find exact matches similarly to the way a book’s index helps you find information quickly within that book. Indexes

Types of Database files

There are 3 types of database files:  1.   Data file It is a primary file and starting point of database. This stores all the data. It also points to other files in database. It has an extension .mdf   2.   Log file This stores all the transaction log information. All log information used to track and recover database. It

SQl Query Optimization

Consider a table with hundreds of columns and millions of records, if your application only really needs a few records, there’s no sense in querying for all the data. It’s a massive waste of resources.  Select all from Categories table: SELECT * FROM Categories  

Stored Procedure

A stored procedure is a group of SQL statements that has been created and stored in the database. A stored procedure will accept input parameters so that a single procedure can be used over the network by several clients using different input data. Stored procedures will reduce network traffic and increase the performance. If we modify a stored procedure

Trigger

A trigger is a special kind of stored procedure that automatically executes when an event occurs in the database server. Triggers are written to be executed in response to any of the following events: 1.   A database manipulation (DML) statement (DELETE, INSERT, or UPDATE) 2.  A database definition (DDL) statement (CREATE, ALTER, or DROP). 3. A database operation (SERVERERROR, LOGON, LOGOFF, STARTUP,

Exception Handling

Exceptions are a type of error that occurs during the execution of a program which is typically problems that are not expected. C# exception handling is built upon four keywords: try, catch, finally, and throw. 1.try − A try block identifies a block of code for which particular exceptions is activated.There can be one or

Lazy Loading and Eager Loading

Eager Loading For loading the related entities of an entity. Eager Loading helps to load all your needed entities at once. i.e.related objects(child objects) are loaded automatically with its parent object. We use ‘include‘ for eager loading.

Virtual Method

The Virtual Method is the method which is declared with the keyword virtual and it can be overridden by the derived class method by using override keyword. It depends on derived class whether to override it or not. If you don’t override, you get the original behaviour, if you do you always get new behaviour.

Method Overriding

Method overriding allows a subclass to provide a specific implementation of a method that is already provided by one of its superclasses. The implementation in the subclass overrides the implementation in the superclass by providing a method that has the same name, parameters or signatures and same return type as the method in the parent