What the heck is ASP.NET Web API?


ASP.NET Web API is a framework that makes it easy to build HTTP services that reach a broad range of clients, including browsers and mobile devices. ASP.NET Web API is an ideal platform for building RESTful applications on the .NET Framework. (Source MSDN)

To get started checkout an article from Mike Wasson - Getting Started with ASP.NET Web API 2 (C#)

What is Entity Framework?


Entity Framework is an Object Relational Mapping framework.

On high level, Object Relational Mapping framework automatically creates classes based on database tables (also known as Schema first approach) or it can also automatically generate necessary SQL to create database tables based on classes (also known as Code First approach).



There are three types of approach used in Entity Framework namely, 

  1. Schema First
  2. Model First
  3. Code First (Commonly used approach in development)

This should be sufficient to convince the interviewer question.

What are the new features of C# 6.0?


C# 6.0 is the latest version which ships with Visual Studio 2015. You to start learning the new features to update yourselves for many different reasons. C# 6.0 is not yet completed and Microsoft is releasing few features now and then. For interview point of view, just mentioned the following items and you should be satisfying the interviewer question.

Following are few features of C# 6.0

1. $ sign

The purpose for it is to simplify string based indexing. Its not some thing like current dynamic features of  C# since it internally uses regular indexing functionality. To understand lets consider following example:

  var col = new Dictionary()
            {
                // using inside the intializer
                $first = "Hassan"
            };

   //Assign value to member

   //the old way:
   col["first"] = "Hassan";
 
   // the new way
   col.$first = "Hassan";

2. Exception filters:

Exception filters are already supported in VB compiler but now they are coming into C#. exception filters lets you specify a condition for a catch block. the catch block gets executed only if the condition is satisfied, this one is my favorite feature, so let's look at an example:

            try
            {
                throw new Exception("Me");
            }
            catch (Exception ex) if (ex.Message == "You")
            {
                // this one will not execute.
            }
            catch (Exception ex) if (ex.Message == "Me")
            {
                // this one will execute
            }

3. await in catch and finally block:

As far as I know, no one know why in C# 5 using await keyword in catch and finally block was not available, any way its now possible to use though. this is great because often we want to perform I/O operation in order to log the exception reason in catch block or such things in finally block and they Need asynchrony.

            try
            {
                DoSomething();
            }
            catch (Exception)
            {
                await LogService.LogAsync(ex);
            }

4. Declaration expressions

This feature simply allows you to declare local variable in the middle of an expression. It is as simple as that but really destroys a pain. I have been doing a lot of asp.net web form projects in the past and this was my every day code:

long id;
if (!long.TryParse(Request.QureyString["Id"], out id))
{ }
which can be improved to this:
Hide   Copy Code
if (!long.TryParse(Request.QureyString["Id"], out long id))
{ }

The scoping rules for this kind of declaration is same as general scoping rules in C#.

5. using Static

This feature allows you to specify a particular type in a using statement after that all static members of that type will be accessible is subsequent code.

using System.Console;

namespace ConsoleApplication10
{
    class Program
    {
        static void Main(string[] args)
        {
            //Use writeLine method of Console class
            //Without specifying the class name
            WriteLine("Hellow World");
        }
    }
}

6. Auto property initializer:

With C# 6 initialize auto properties just like a field at declaration place. The only thing to notice here is that this initialization dose not cause the setter function to be invoked internally. the value of backing field is set directly. so here is an example:

public class Person
    {
        // You can use this feature on both
        //getter only and setter / getter only properties

        public string FirstName { get; set; } = "Hassan";
        public string LastName { get; } = "Hashemi";
    }

7. Primary Constructor:

The main purpose for it is using constructor parameters for initialization. When declaring a primary constructor all other constructors must call the primary constructor using :this().
here is an example finally:

    //this is the primary constructor:
    class Person(string firstName, string lastName)
    {
        public string FirstName { get; set; } = firstName;
        public string LastName  { get; } = lastName;
    }

notice that declaration of primary constructor is at the top of the class.

8- Dictionary Initializer:

Some people believed that the old way of initiailzing dictionaries was dirty so the C# team dicided to make it cleaner, thanks to them. here is an example of the old way and new way:


            // the old way of initializing a dictionary
            Dictionary oldWay = new Dictionary()
            {
                { "Afghanistan", "Kabul" },
                { "United States", "Washington" },
                { "Some Country", "Some Capital city" }
            };

            // new way of initializing a dictionary
            Dictionary newWay = new Dictionary()
            {
                // Look at this!
                ["Afghanistan"] = "Kabul",
                ["Iran"] = "Tehran",
                ["India"] = "Delhi"
            };

Note: To play around and know more about C# 6.0 download Visual Studio 2015 click here

What is Data Model?


Definition:

A data model is a description of the organization of data in a database. It also describes the relationship among data and any constraints that have to be defined on the data.

Data models can be broadly be classified into two categories:

  • Object-based logical model
          It focuses on describing the data, the relationship among the data, and any constraints defined.
  • Record-base logical model
          It focuses on describing the data structure and the access techniques in a Database Management System.


What is Database Management system (DBMS)?


Definition 1:

A database management system (DBMS) is a software used to store and manage data. A DBMS stores data in databases and uses data models to describe the various ways of organizing data.

Definition 2:

Database Management System  is the task of maintaining databases so that information is readily available.

DBMS's are designed to maintain large volumes of data.Management of data involves:

  • Defining structures of data storage.
  • Providing mechanisms for data manipulation such as adding, editing, and deleting data.
  • Providing data security against unauthorized access.


What is a Database?


Definition:

A database is a collection of logically related information.


Following are the top 10 database engines using by companies around the globe:

  • Oracle
  • MySQL
  • Microsoft SQL Server
  • PostgreSQL
  • DB2
  • MongoDB
  • Microsoft Access
  • SQLite
  • Sybase
  • Teradata

What is Relational Database Management System (RDBMS)?


Definition:

A relational database management system (RDBMS) is an advanced version of DBMS that also defines the relationship between the various data values. It helps in organizing and accessing data more efficiently than DBMS.

What is a Class in Object Oriented Programming (OOP)?


Definition:

Class is a declaration, a template, or a blueprint that can be used to classify objects.

For example, the peacock, the sparrow, and the kingfisher are all birds. All of them share characteristics that are common to the family of birds. All of them lay eggs, are covered with feathers, have hollow bone structures, and have the ability to fly. Therefore, they share structural and behavioral similarities and belong to the class called Birds.


What is an object in Object Orientation (OOP)?


Definition 1:

An object is a combination of messages and data. Objects can receive and send messages and use messages to interact with each other. The messages contain information that is to be passed to the recipient object.


Definition 2:

An object literally means a 'material thing' that is capable of being presented to the senses.


Definition 3:

An object is a tangible entity that may exhibit some well-defined behavior. For example, let us consider a tennis ball:

  • A tennis ball is a tangible entity, with a visible boundary.
  • A tennis ball has a specific defined purpose (such as bouncing)
  • You can direct a specific action towards a tennis ball by hitting it with racquet or by tossing it.

What is Object Oriented Programming (OOP) ?


Object-Oriented Programming (OOP) is one of the most popular methodologies in software development. It offers a powerful model for creating computer programs. It speeds the program development process, improves maintenance and enhances reusablity of programs.

Recent Posts