Posts

WCF Self Hosting

Image
n web service, we can host the service only in IIS, but WCF provides the user to host the service in any application (e.g. console application, Windows form etc.). Very interestingly developer is responsible for providing and managing the life cycle of the host process. Service can also be in-pro i.e. client and service in the same process. Now let's us create the WCF service which is hosted in Console application. We will also look in to creating proxy using  'ClientBase'  abstract class. Note:  Host process must be running before the client calls the service, which typically means you have to prelaunch it. Step 1:  First let's start create the Service contract and it implementation. Create a console application and name it as MyCalculatorService. This is simple service which return addition of two numbers. Step 2:  Add the System.ServiceModel reference to the project. Step 3:  Create an ISimpleCalculator interface, Add ServiceContract and O...

WCF IIS 5/6 Hosting

Image
The main advantage of hosting service in IIS is that, it will automatically launch the host process when it gets the first client request. It uses the features of IIS such as process recycling, idle shutdown, process health monitoring and message based activation. The main disadvantage of using IIS is that, it will support only HTTP protocol. Let as do some hands on, to create service and host in IIS Step 1: Start the Visual Studio 2008 and click File->New->Web Site. Select the 'WCF Service' and Location as http. This will directly host the service in IIS and click OK. Step 2:  I have created sample HelloWorld service, which will accept name as input and return with 'Hello' and name. Interface and implementation of the Service is shown below. IMyService.cs [ServiceContract] public interface IMyService { [OperationContract] string HelloWorld(string name); } MyService.cs public class MyService : IMyService { #region IMyService Member...

Introduction to Ado.net

Before Ado.net we use Ado (Active Database Object) to access data from databae. Basically Ado has automatic driver detection technique and tt has only one drawback that it only provide a connected environment so efficiency of system may decrease. ADO.NET is a new database technology used by .Net platform (introduced in 2002).Infact it is a set of classes used to communicate between an application front end and a database.It supports both connected & disconnection mode of data access. Mandatory Namespaces used in ADO.Net In any .NET data access page, before you connect to a database, you first have to import all the necessary namespaces that will allow you to work with the objects required. Namespaces used in ADO.Net are : System.Data It contains the common classes for connecting, fetching data from database. Classes are like as DataTable, DataSet, DataView etc. System.Data.SqlClient It contains classes for connecting, fetching data from Sql Server database. Classe...

Different Types of JIT Complier

Image
JIT stands for just-in-time compiler. It converts the MSIL code to CPU native code as it is needed during code execution. It is called just-in-time since it converts the MSIL code to CPU native code; when it is required within code execution otherwise it will not do nothing with that MSIL code. Different Types of JIT Normal JIT This complies only those methods that are called at runtime. These methods are compiled only first time when they are called, and then they are stored in memory cache. This memory cache is commonly called as JITTED. When the same methods are called again, the complied code from cache is used for execution. Econo JIT This complies only those methods that are called at runtime and removes them from memory after execution. Pre JIT This complies entire MSIL code into native code in a single compilation cycle. This is done at the time of deployment of the application.

Understanding Relationship Between CTS and CLS

Image
CTS and CLS are parts of .NET CLR and are responsible for type safety with in the code. Both allow cross language communication and type safety. In this article I would like to expose the relationship between these two. CTS CTS stands for Common Type System. It defines the rules which Common Language Runtime follows when declaring, using, and managing types. The common type system performs the following functions: It enables cross-language integration, type safety, and high-performance code execution. It provides an object-oriented model for implementation of many programming languages. It defines rules that every language must follow which runs under .NET framework. It ensures that objects written in different .NET Languages like C#, VB.NET, F# etc. can interact with each other. CLS CLS stands for Common Language Specification and it is a subset of CTS. It defines a set of rules and restrictions that every language must follow which runs under .NET framework. Th...

A brief version history of .NET Framework

 .Net is a software development platform developed by Microsoft. It runs on Microsoft Windows OS. .NET provides tools and libraries that allow developers to develop applications and services much easily, faster and secure by using a convenient way. .NET Framework Version History .NET Version Introduced with IDE Features Detail 4.5.1 Visual Studio 2013 Includes performance and debugging improvements Support for automatic binding redirection Expanded support for Windows Store apps 4.5 Visual Studio 2012 Features Enhancements to CLR 4.0 Async Support Support for building Windows Store apps Features Enhancement to WPF, WCF, WF, and ASP.NET 4.0 Visual Studio 2010 Introduced CLR 4.0 Managed Extensibility Framework (MEF) Dynamic Language Runtime (DLR) Task Parallel Library 3.5 Visual Studio 2008 Built-In AJAX Support LINQ Dynamic Data Multi-targeting Framework Support 3.0 Visual Studio 2...

Types of Join in SQL Server

Image
What is join?? An SQL  JOIN  clause is used to combine rows from two or more tables, based on a common field between them. There are many types of  join . Inner Join Equi-join Natural Join Outer Join Left outer Join Right outer join Full outer join Cross Join Self Join Using the Code Join  is very useful to fetching records from multiple tables with reference to common column between them. To understand  join  with example, we have to create two tables in SQL Server database. Employee Hide     Copy Code create table Employee( id int identity ( 1 , 1 ) primary key , Username varchar ( 50 ), FirstName varchar ( 50 ), LastName varchar ( 50 ), DepartID int ) Departments Hide     Copy Code create table Departments( id int identity ( 1 , 1 ) primary key , DepartmentName varchar ( 50 ) ) Now fill  Employee  table with demo records like that. Fill  Departm...