Today I am going to explain difference between Primary key and Foreign key in SQL. It is very frequently asked interview question for beginner or experienced. So, I will try to explain one by one.
Primary Key
1. Primary key is a column or set of columns that is basically used to identity a rows in table.
2. Primary key can’t be null. It means that if you define a column or set of columns as primary key then you can not pass null value in that column.
Repeater control is used to show a repeated list of items from data source like data table, database, xml file, list etc. in Asp.Net that are bound to the control. Basically Asp.Net Repeater control is nothing but a container that shows the data from available data source in table format.Repeater control provides us a table layout. There are different types of template exists in Repeater.
Extension method is a new feature added in c# 3.0. An Extension method is used to add new behaviors to base type without changing the base feature. Extension methods can be attached to any other existing class without changing that particular class. Using extension method you can add a method of existing type or modify the original. Basically Extension methods are static methods.
InVisual Studio when we try to create WCF services then we will meet with different type of template available in WCF like WCF Service Library, WCF Service Application etc. When we create a project for wcf service, we have to choose right type of template to create WCF service. But sometimes beginner is being so confused to choose right type of template for WCF service.
Repository Pattern is used to create an abstraction layer between data access layer and business logic layer of an application. Repository directly communicates with data access layer [DAL] and gets the data and provides it to business logic layer [BAL]. The main advantage to use repository pattern to isolate the data access logic and business logic, so that if you make changes in any of this logic that cannot effect directly on other logic.
Microsoft provides us functionality to send email using C# code. We can use System.Net and System.Net.Sockets namespace to send email. Basically these namespace is responsible for sending the data and receiving the data over internet. SMTP protocol is used for sending the emails. SMTP stands for Simple Mail Transfer Protocol. Today, I am going to show, how to create an WPF application to send emails using gmail. Gmail always uses SSL/TLS authentication, so to send email you have to enable SSL property for the port 587 or 465.
Constructor is the special type of method of a class which invoke automatically when instance of class is created. Constructor is used to object initialization and memory allocation of the class. Constructor is used to initialize private fields value of the class whenever instance or object of class is created. Constructor can be overloaded. When we don’t create constructor for the class, the compiler automatically create a default constructor for the class. Constructor name is always same of the class name
If we use same name controller in Area and Root in Asp.Net MVC application than we will conflict and throw an error like below.
~/Controllers/HomeController.cs
~/Areas/Blog/Controllers/HomeController.cs
Multiple types were found that match the controller named 'Home'. This can happen if the route that services this request ('{controller}/{action}/{id}') does not specify namespaces to search for a controller that matches the request
.To resolve it we have to provide the proper namespace when creating route for both.
Cookie is less memory space on web server that is used to store the small data. So, basically cookie is small text file that is created by web server and saved it by browser. It is used to store the small amount of data on the browser when someone is visiting a site using browser. The common purpose to use cookie is to remember the user who has already visited. So, It maintain the personal information on the client machine within the browser.
In this article, I will explain you how to create a WCF service using “WCF Service Library” and also how to host it and consume it in our client application. When You try to create a new service from new project window in visual studio. You will find two main categories for wcf service. One is WCF service library and the second one is WCF service application. If you want to know difference between WCF Service Application and WCF Service Library, you can visit this link.