Skip to main content

Difference between WCF and Web API

Difference between WCF and Web API

WCF Web API
WCF ships with .NET Framework only Web API ships with .NET framework as well as open source
WCF Supports RESTful services but in limited manner Web API is very ideal to build RESTful services
WCF use attribute based programming model Web API maps http verbs to methods
WCF supports reliable transaction and messaging Web API doesn’t support reliable transaction and messaging
WCF supports tcp, udp, http protocol and also custom transport protocol It supports only http protocol
WCF uses Operation, Data contracts and services Web API uses routing, controller, action methods etc, same to Asp.Net MVC

Understand the value type and reference type

In previous article we have seen difference between primary key and unique key. Today we will see the difference between value type and reference type.

Let first see what are the value types and what are the reference types.

What are Value Types?
Variables which stores direct data are called value types they are stored on a stack. They contains the actual value rather then reference.
For an example enum, structure int are value types.

What are Reference Types?
Variables which stores reference of actual data are called Reference types. They are stored on heap but contain the address on heap.
For an example Array, class, object, string, delegate, interface are reference type.

Now lets see the difference between both of them.

Before that let me show you the difference between Stack and Heap

Difference between Stack and Heap

Stack Heap
Stack is used for value types. Heap is used for reference types
Values are stored one on another like a stack Values are stored in random order.like dumped into a big space

Difference between value type and reference types

Value Type Reference Type
Value Type are stored on stack Reference Type are stored on heap
It contains actual value It contains reference of a value
For value type memory is allocated at compile time For reference type memory is allocated at run time
Once they go out of scope it will automatically removed from stack, so no need for garbage collector. In reference type it required garbage collector to free the memory.
If value type is null able then only it contains null value, otherwise not Reference Type can contain null values.

That’s it.

Difference between WebForm and MVC in Asp.Net

Asp.net framework is a small part of .Net framework for building and running web applications. We can design and develop a web application or website using either Asp.Net MVC for Web Forms. In this article we will see some important difference between Asp.Net Web Forms and Asp.Net MVC.

Difference between WebForm and MVC in Asp.Net

Asp.Net Web Form Asp.Net Web MVC
Asp.Net Web Form is not an Open Source. Asp.Net Web MVC is an Open Source.
In Asp.Net you will have a server controls like TextBox, Buttons etc. In Asp.Net MVC you will have html helpers.
For client side state management Asp.Net Web Forms supports view state In Asp.Net MVC view state is not supported.
Asp.Net Web Form follows Web Forms Syntax Asp.Net MVC follow customizable syntax (by default it’a a Razor)
Asp.Net Web Form has file-based URLs that means file name exist in the URLs must have its physically file existence. Asp.Net MVC has route-based URLs means URLs are divided into controllers and actions and it is based on controller and actions, physical file is not required here.
In Asp.Net Web Form, ASPX pages are tightly coupled to Code behind(.CS). In Asp.Net MVC, design (Views) and logic(Controller) are resides separately.
In Asp.Net, for consistent look and feels we can use Master Pages. In Asp.Net, for consistent look and feels we can use Layout views.
In Asp.Net, for code re-usability we can use User controls. In Asp.Net, for code re-usability we can use Partial Views.
Asp.Net Web Form follow a traditional event driven development model. Asp.Net MVC follow MVC (Model, View, Controller) pattern based development model.
Asp.Net Web Form has built-in data controls and best for rapid development with powerful data access like repeater, grid etc. Asp.Net MVC provides full control over html markup and support many features that allow fast and agile development. Asp.Net MVC is is best for developing interactive web application with latest web standards.

I hope it will help you to identified the basic difference between Asp.Net Web Forms and Asp.Net MVC.